Skip to content
Commit 5b21e3c7 authored by Javier Martinez Canillas's avatar Javier Martinez Canillas Committed by Dmitry Torokhov
Browse files

Input: joydev - fix possible ERR_PTR() dereferencing



Commit 5702222c ("Input: joydev - use memdup_user() to duplicate
memory from user-space") changed the kmalloc() and copy_from_user()
with a single call to memdup_user() but wrongly used the same error
path than the old code in which the buffer allocated by kmalloc() was
freed if copy_from_user() failed.

This is of course wrong since if memdup_user() fails, no memory was
allocated and the error in the error-valued pointer should be returned.

Fixes: 5702222c ("Input: joydev - use memdup_user() to duplicate
memory from user-space")
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarJavier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent c7efd123
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment