]> git.ipfire.org Git - thirdparty/linux.git/commit
ipmi: Fix user refcount underflow in event delivery
authorMatt Fleming <mfleming@cloudflare.com>
Thu, 21 May 2026 13:06:27 +0000 (14:06 +0100)
committerCorey Minyard <corey@minyard.net>
Thu, 21 May 2026 14:15:00 +0000 (09:15 -0500)
commit6aa9e61c46465d231e9beddf56af7effd71be682
treea1681c330d2518a2c66421d5777db07fa754cf46
parent8a8ba84886c905bd43dbdc3b3f78c7ba8f8661f3
ipmi: Fix user refcount underflow in event delivery

ipmi_alloc_recv_msg(user) takes the temporary user reference owned by the
receive message, and ipmi_free_recv_msg() drops it again. If event delivery
fails after allocating receive messages for earlier users,
handle_read_event_rsp() rolls those messages back with
ipmi_free_recv_msg().

That rollback path still drops user->refcount explicitly after freeing each
message. The extra put can free a user that remains linked on intf->users,
so later event delivery may dereference a freed user or trip refcount_t's
addition-on-zero warning when ipmi_alloc_recv_msg() tries to acquire
another reference.

Remove the stale explicit put and the now-dead user assignment. Keep the
list_del() and ipmi_free_recv_msg() calls; they are the required rollback
operations.

Fixes: b52da4054ee0 ("ipmi: Rework user message limit handling")
Cc: stable@vger.kernel.org # v6.18+
Signed-off-by: Matt Fleming <mfleming@cloudflare.com>
Message-ID: <20260521130628.3641050-1-matt@readmodwrite.com>
Signed-off-by: Corey Minyard <corey@minyard.net>
drivers/char/ipmi/ipmi_msghandler.c