summaryrefslogtreecommitdiffstats
path: root/drivers/staging/gasket/gasket_ioctl.c
diff options
context:
space:
mode:
authorTodd Poynor <toddpoynor@google.com>2018-07-21 06:34:57 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-07-24 13:56:45 +0200
commit5c4a5d3ddd724d1c4f27c3b52ad0980c4c750999 (patch)
tree3f3c2ad9f5f5d498c3ea026dfbf878cf12701f28 /drivers/staging/gasket/gasket_ioctl.c
parent8fc1cb4cef287fd61391adcc48f4a6bdc369bf49 (diff)
staging: gasket: avoid copy to user on error in coherent alloc config
gasket_config_coherent_allocator() on error return the error to caller without copying a possibly-update DMA address back to userspace. Reported-by: Dmitry Torokhov <dtor@chromium.org> Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/gasket/gasket_ioctl.c')
-rw-r--r--drivers/staging/gasket/gasket_ioctl.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/staging/gasket/gasket_ioctl.c b/drivers/staging/gasket/gasket_ioctl.c
index 1b164ac7a049..8cf094b90cdb 100644
--- a/drivers/staging/gasket/gasket_ioctl.c
+++ b/drivers/staging/gasket/gasket_ioctl.c
@@ -441,8 +441,10 @@ static int gasket_config_coherent_allocator(
gasket_dev, ibuf.size, &ibuf.dma_address,
ibuf.page_table_index);
}
+ if (ret)
+ return ret;
if (copy_to_user(argp, &ibuf, sizeof(ibuf)))
return -EFAULT;
- return ret;
+ return 0;
}