From: Hailong Liu Date: Wed, 13 Feb 2019 16:29:36 +0000 (+0000) Subject: uio: fix wrong return value from uio_mmap() X-Git-Tag: v4.14.100~3 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=28c618abeee3380a4ead50fe9863b692dd851e07;p=users%2Fjedix%2Flinux-maple.git uio: fix wrong return value from uio_mmap() commit e7de2590f18a272e63732b9d519250d1b522b2c4 upstream. uio_mmap has multiple fail paths to set return value to nonzero then goto out. However, it always returns *0* from the *out* at end, and this will mislead callers who check the return value of this function. Fixes: 57c5f4df0a5a0ee ("uio: fix crash after the device is unregistered") CC: Xiubo Li Signed-off-by: Hailong Liu Cc: stable Signed-off-by: Jiang Biao Signed-off-by: Greg Kroah-Hartman Signed-off-by: Tommi Rantala Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index 262610192755f..fed2d8fa4d4d4 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c @@ -816,7 +816,7 @@ static int uio_mmap(struct file *filep, struct vm_area_struct *vma) out: mutex_unlock(&idev->info_lock); - return 0; + return ret; } static const struct file_operations uio_fops = {