From: Todd Poynor Date: Sat, 21 Jul 2018 13:34:57 +0000 (-0700) Subject: staging: gasket: avoid copy to user on error in coherent alloc config X-Git-Tag: for-linus-20180825~50^2~379 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=5c4a5d3ddd724d1c4f27c3b52ad0980c4c750999;p=linux-2.6-block.git 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 Signed-off-by: Todd Poynor Signed-off-by: Greg Kroah-Hartman --- 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; }