From: Corey Minyard <corey@minyard.net>
To: Yifei Gao <gyf161023@gmail.com>
Cc: openipmi-developer@lists.sourceforge.net,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] ipmi: Fix use-after-free of cmd_rcvr in _ipmi_destroy_user()
Date: Tue, 25 Aug 2026 19:55:23 -0500 [thread overview]
Message-ID: <ao45ez_1op-h2Na2@mail.minyard.net> (raw)
In-Reply-To: <20260825234630.1196170-1-gyf161023@gmail.com>
On Tue, Aug 25, 2026 at 11:46:29PM +0000, Yifei Gao wrote:
> Commit 9e91f8a6c868 ("ipmi:msghandler: Remove srcu for the
> ipmi_interfaces list") dropped the synchronize_rcu() between unlinking
> the command receivers from intf->cmd_rcvrs and freeing them, updating
> only the comment that explains why the barrier is needed.
>
> The cmd_rcvrs list is still traversed under plain RCU: find_cmd_rcvr()
> walks it inside rcu_read_lock(), and handle_ipmb_get_msg_cmd() borrows
> rcvr->user from that lookup within the same read-side section. Without
> the grace period, _ipmi_destroy_user() can kfree() a cmd_rcvr while a
> reader still holds a pointer to it, causing a use-after-free.
>
> The rework only made srcu unnecessary for the interfaces list; the
> cmd_rcvrs list still relies on plain RCU. Restore the synchronize_rcu()
> before freeing the receivers.
Yes, looks good and passes tests, it's in my next tree.
-corey
>
> Fixes: 9e91f8a6c868 ("ipmi:msghandler: Remove srcu for the ipmi_interfaces list")
> Cc: stable@vger.kernel.org
> Assisted-by: Claude:claude-opus-4-8
> Signed-off-by: Yifei Gao <gyf161023@gmail.com>
> ---
> drivers/char/ipmi/ipmi_msghandler.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
> index ab4c85f3d6fe..3f4018194df8 100644
> --- a/drivers/char/ipmi/ipmi_msghandler.c
> +++ b/drivers/char/ipmi/ipmi_msghandler.c
> @@ -1391,6 +1391,7 @@ static void _ipmi_destroy_user(struct ipmi_user *user)
> }
> }
> mutex_unlock(&intf->cmd_rcvrs_mutex);
> + synchronize_rcu();
> while (rcvrs) {
> rcvr = rcvrs;
> rcvrs = rcvr->next;
> --
> 2.43.0
>
prev parent reply other threads:[~2026-08-26 0:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-25 23:46 Yifei Gao
2026-08-26 0:55 ` 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=ao45ez_1op-h2Na2@mail.minyard.net \
--to=corey@minyard.net \
--cc=gyf161023@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=openipmi-developer@lists.sourceforge.net \
--cc=stable@vger.kernel.org \
/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
all inboxes | Powered by JetHome®