From: Corey Minyard <minyard@acm.org>
To: Dan Carpenter <error27@gmail.com>
Cc: openipmi-developer@lists.sourceforge.net,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] ipmi: fix use after free in _ipmi_destroy_user()
Date: Tue, 15 Nov 2022 08:15:26 -0600 [thread overview]
Message-ID: <Y3Oe6KcXabXlwdbx@minyard.net> (raw)
In-Reply-To: <Y3M8xa1drZv4CToE@kili>
On Tue, Nov 15, 2022 at 04:17:43PM +0300, Dan Carpenter wrote:
> The intf_free() function frees the "intf" pointer so we cannot
> dereference it again on the next line.
Thanks. I will request a backport for 5.5 and later.
>
> Fixes: cbb79863fc31 ("ipmi: Don't allow device module unload when in use")
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
> drivers/char/ipmi/ipmi_msghandler.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
> index f6b8ca6df9b5..186f1fee7534 100644
> --- a/drivers/char/ipmi/ipmi_msghandler.c
> +++ b/drivers/char/ipmi/ipmi_msghandler.c
> @@ -1330,6 +1330,7 @@ static void _ipmi_destroy_user(struct ipmi_user *user)
> unsigned long flags;
> struct cmd_rcvr *rcvr;
> struct cmd_rcvr *rcvrs = NULL;
> + struct module *owner;
>
> if (!acquire_ipmi_user(user, &i)) {
> /*
> @@ -1392,8 +1393,9 @@ static void _ipmi_destroy_user(struct ipmi_user *user)
> kfree(rcvr);
> }
>
> + owner = intf->owner;
> kref_put(&intf->refcount, intf_free);
> - module_put(intf->owner);
> + module_put(owner);
> }
>
> int ipmi_destroy_user(struct ipmi_user *user)
> --
> 2.35.1
>
prev parent reply other threads:[~2022-11-15 14:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-15 13:17 [PATCH] ipmi: fix use after free in _ipmi_destroy_user() Dan Carpenter
2022-11-15 14:15 ` Corey Minyard [this message]
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=Y3Oe6KcXabXlwdbx@minyard.net \
--to=minyard@acm.org \
--cc=error27@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=openipmi-developer@lists.sourceforge.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.