[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1546446416-40831-1-git-send-email-liujian56@huawei.com>
Date: Thu, 3 Jan 2019 00:26:56 +0800
From: liujian <liujian56@...wei.com>
To: <gregkh@...uxfoundation.org>
CC: <xiubli@...hat.com>, <liujian56@...wei.com>,
<linux-kernel@...r.kernel.org>
Subject: [PATCH] driver: uio: fix possible memory leak in uio_open
Fixes: 57c5f4df0a5a ("uio: fix crash after the device is unregistered")
Signed-off-by: liujian <liujian56@...wei.com>
---
drivers/uio/uio.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index 5c10fc7..bde7d7a 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -496,7 +496,7 @@ static int uio_open(struct inode *inode, struct file *filep)
if (!idev->info) {
mutex_unlock(&idev->info_lock);
ret = -EINVAL;
- goto err_alloc_listener;
+ goto err_infoopen;
}
if (idev->info && idev->info->open)
@@ -508,6 +508,7 @@ static int uio_open(struct inode *inode, struct file *filep)
return 0;
err_infoopen:
+ filep->private_data = NULL;
kfree(listener);
err_alloc_listener:
--
2.7.4
Powered by blists - more mailing lists