uio: fix potential memory leak in error case

This change “uio: fix potential memory leak in error case” in Linux kernel is authored by Chengguang Xu <cgxu519 [at] gmx.com> on Thu Jan 17 17:27:46 2019 +0800.

uio: fix potential memory leak in error case

Should jump to lable err_infoopen when idev->info is NULL
in uio_open().

Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

This Linux change may have been applied to various maintained Linux releases and you can find Linux releases including commit 1e09cdd.

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 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 1313422..46e5c1c 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -491,7 +491,7 @@ static int uio_open(struct inode *inode, struct file *filep)
 	if (!idev->info) {
 		ret = -EINVAL;
-		goto err_alloc_listener;
+		goto err_infoopen;
 	if (idev->info && idev->info->open)

The commit for this change in Linux stable tree is 1e09cdd (patch).

Leave a Reply

Your email address will not be published. Required fields are marked *