uio: fix wrong return value from uio_mmap()
authorHailong Liu <[email protected]>
Fri, 20 Jul 2018 00:31:56 +0000 (08:31 +0800)
committerGreg Kroah-Hartman <[email protected]>
Sat, 21 Jul 2018 06:45:24 +0000 (08:45 +0200)
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 <[email protected]>
Signed-off-by: Hailong Liu <[email protected]>
Cc: stable <[email protected]>
Signed-off-by: Jiang Biao <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/uio/uio.c

index f63967c8e95abb1696ff9c10e7b87f299218a3e7..144cf736528812eb13a802bf0c1b9c623ed8bf6b 100644 (file)
@@ -813,7 +813,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 = {