From: Greg KH <gregkh@linuxfoundation.org>
To: Liu Jian <liujian56@huawei.com>
Cc: xiubli@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5] driver: uio: fix possible memory leak in uio_open
Date: Thu, 31 Jan 2019 16:36:21 +0100 [thread overview]
Message-ID: <20190131153621.GA16678@kroah.com> (raw)
In-Reply-To: <1548196704-352035-1-git-send-email-liujian56@huawei.com>
On Wed, Jan 23, 2019 at 06:38:24AM +0800, Liu Jian wrote:
> If 'idev->info' is NULL, we need to free 'listener'
>
> Fixes: 57c5f4df0a5a ("uio: fix crash after the device is unregistered")
> Signed-off-by: Liu Jian <liujian56@huawei.com>
> ---
> v1->v2:
> rename the "err_infoopen" to "err_idev_info"
> v2->3:
> put the extra info after the "--"
> v3-v4:
> add git log
> v4-v5:
> correct git log
>
> drivers/uio/uio.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
> index 1313422..b4ae2d9 100644
> --- a/drivers/uio/uio.c
> +++ b/drivers/uio/uio.c
> @@ -491,18 +491,19 @@ 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_idev_info;
> }
>
> if (idev->info && idev->info->open)
> ret = idev->info->open(idev->info, inode);
> mutex_unlock(&idev->info_lock);
> if (ret)
> - goto err_infoopen;
> + goto err_idev_info;
>
> return 0;
>
> -err_infoopen:
> +err_idev_info:
> + filep->private_data = NULL;
> kfree(listener);
>
> err_alloc_listener:
> --
> 2.7.4
>
This does not apply to my tree at all :(
Please rebase it against the char-misc-next branch of my char-misc.git
tree and resend.
thanks,
greg k-h
next prev parent reply other threads:[~2019-01-31 15:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-22 22:38 [PATCH v5] driver: uio: fix possible memory leak in uio_open Liu Jian
2019-01-31 15:36 ` Greg KH [this message]
2019-02-01 1:45 ` liujian (CE)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190131153621.GA16678@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liujian56@huawei.com \
--cc=xiubli@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox