drm: return -EFAULT if copy_to_user() fails
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 18 Jun 2019 13:18:43 +0000 (16:18 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 21 Jul 2019 07:04:27 +0000 (09:04 +0200)
commit8945fba0e3799246bfaf26b15fd28cdad0b26b26
tree333ad7a9a49c2bb8afffe2b323cb695bd9368131
parent39e006a60360316ab4ca803bc867fe2160528a93
drm: return -EFAULT if copy_to_user() fails

[ Upstream commit 74b67efa8d7b4f90137f0ab9a80dd319da050350 ]

The copy_from_user() function returns the number of bytes remaining
to be copied but we want to return a negative error code.  Otherwise
the callers treat it as a successful copy.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190618131843.GA29463@mwanda
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/drm_bufs.c
drivers/gpu/drm/drm_ioc32.c