diff options
author | Olav Haugan <ohaugan@codeaurora.org> | 2012-05-15 14:40:11 -0700 |
---|---|---|
committer | Varun Wadekar <vwadekar@nvidia.com> | 2012-08-13 14:13:11 +0530 |
commit | b44965142ae0afdf53114bd5da27ebad5e839bb7 (patch) | |
tree | 29a1247f38f5e214289f6bcb7d1173ca2aeae6b1 | |
parent | d7e9498c0466f46de7b66c04c56b245979f20db7 (diff) |
gpu: ion: IOCTL return success when error occurs
ION_IOC_MAP, ION_IOC_SHARE, and ION_IOC_IMPORT may return
success when an error occurs.
Add correct error handling to ION_IOC_MAP, ION_IOC_SHARE, and
ION_IOC_IMPORT.
Change-Id: I61c6b0c574da425604235b2d39e13e4a27f7b6f3
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
-rw-r--r-- | drivers/gpu/ion/ion.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/gpu/ion/ion.c b/drivers/gpu/ion/ion.c index 01e5cffe913e..705681a7280f 100644 --- a/drivers/gpu/ion/ion.c +++ b/drivers/gpu/ion/ion.c @@ -1068,20 +1068,27 @@ static long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) data.fd = ion_share_dma_buf(client, data.handle); if (copy_to_user((void __user *)arg, &data, sizeof(data))) return -EFAULT; + if (data.fd < 0) + return data.fd; break; } case ION_IOC_IMPORT: { struct ion_fd_data data; + int ret = 0; if (copy_from_user(&data, (void __user *)arg, sizeof(struct ion_fd_data))) return -EFAULT; data.handle = ion_import_dma_buf(client, data.fd); - if (IS_ERR(data.handle)) + if (IS_ERR(data.handle)) { + ret = PTR_ERR(data.handle); data.handle = NULL; + } if (copy_to_user((void __user *)arg, &data, sizeof(struct ion_fd_data))) return -EFAULT; + if (ret < 0) + return ret; break; } case ION_IOC_SYNC: |