* [PATCH] uio: fix wrong return value from uio_mmap()
@ 2018-07-20 0:31 Hailong Liu
2018-07-20 0:40 ` Xiubo Li
0 siblings, 1 reply; 2+ messages in thread
From: Hailong Liu @ 2018-07-20 0:31 UTC (permalink / raw)
To: gregkh; +Cc: xiubli, linux-kernel, jiang.biao2, zhong.weidong, Hailong Liu
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 <xiubli@redhat.com>
Signed-off-by: Hailong Liu <liu.hailong6@zte.com.cn>
Signed-off-by: Jiang Biao <jiang.biao2@zte.com.cn>
---
drivers/uio/uio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index 5d421d7..0ddfda2 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -814,7 +814,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 = {
--
1.8.3.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] uio: fix wrong return value from uio_mmap()
2018-07-20 0:31 [PATCH] uio: fix wrong return value from uio_mmap() Hailong Liu
@ 2018-07-20 0:40 ` Xiubo Li
0 siblings, 0 replies; 2+ messages in thread
From: Xiubo Li @ 2018-07-20 0:40 UTC (permalink / raw)
To: Hailong Liu, gregkh; +Cc: linux-kernel, jiang.biao2, zhong.weidong
On 2018/7/20 8:31, Hailong Liu wrote:
> 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 <xiubli@redhat.com>
> Signed-off-by: Hailong Liu <liu.hailong6@zte.com.cn>
> Signed-off-by: Jiang Biao <jiang.biao2@zte.com.cn>
> ---
> drivers/uio/uio.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
> index 5d421d7..0ddfda2 100644
> --- a/drivers/uio/uio.c
> +++ b/drivers/uio/uio.c
> @@ -814,7 +814,7 @@ static int uio_mmap(struct file *filep, struct vm_area_struct *vma)
>
> out:
> mutex_unlock(&idev->info_lock);
> - return 0;
> + return ret;
Hi Hailong,
Good catch, Thanks.
BRs
> }
>
> static const struct file_operations uio_fops = {
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-07-20 0:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-20 0:31 [PATCH] uio: fix wrong return value from uio_mmap() Hailong Liu
2018-07-20 0:40 ` Xiubo Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome