Skip to content

Commit 7024b4a

Browse files
groeckgregkh
authored andcommitted
ipmi: Fix handling of messages with provided receive message pointer
commit e2c69490dda5d4c9f1bfbb2898989c8f3530e354 upstream. Prior to commit b52da4054ee0 ("ipmi: Rework user message limit handling"), i_ipmi_request() used to increase the user reference counter if the receive message is provided by the caller of IPMI API functions. This is no longer the case. However, ipmi_free_recv_msg() is still called and decreases the reference counter. This results in the reference counter reaching zero, the user data pointer is released, and all kinds of interesting crashes are seen. Fix the problem by increasing user reference counter if the receive message has been provided by the caller. Fixes: b52da4054ee0 ("ipmi: Rework user message limit handling") Reported-by: Eric Dumazet <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: Greg Thelen <[email protected]> Signed-off-by: Guenter Roeck <[email protected]> Message-ID: <[email protected]> Signed-off-by: Corey Minyard <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent c6d2547 commit 7024b4a

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

drivers/char/ipmi/ipmi_msghandler.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2280,8 +2280,11 @@ static int i_ipmi_request(struct ipmi_user *user,
22802280
if (supplied_recv) {
22812281
recv_msg = supplied_recv;
22822282
recv_msg->user = user;
2283-
if (user)
2283+
if (user) {
22842284
atomic_inc(&user->nr_msgs);
2285+
/* The put happens when the message is freed. */
2286+
kref_get(&user->refcount);
2287+
}
22852288
} else {
22862289
recv_msg = ipmi_alloc_recv_msg(user);
22872290
if (IS_ERR(recv_msg))

0 commit comments

Comments
 (0)