staging: android: ion: Fix error handling in ion_query_heaps()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 13 Oct 2016 12:55:08 +0000 (15:55 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Oct 2016 13:36:15 +0000 (15:36 +0200)
commitcf55902b9c306ed259eb57ff111a0c152620f4a6
tree52336fa644b83a8b467b9b64f1218f25be5f9920
parent8b77eb97f7847d67129d5312596e953bd7946f48
staging: android: ion: Fix error handling in ion_query_heaps()

If the copy_to_user() fails we should unlock and return directly without
updating "cnt".  Also the return value should be -EFAULT instead of the
number of bytes remaining.

Fixes: 02b23803c6af ("staging: android: ion: Add ioctl to query available heaps")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/android/ion/ion.c