ipmi: Rework user message limit handling
authorCorey Minyard <corey@minyard.net>
Fri, 5 Sep 2025 16:33:39 +0000 (11:33 -0500)
committerCorey Minyard <corey@minyard.net>
Mon, 8 Sep 2025 15:21:28 +0000 (10:21 -0500)
commitb52da4054ee0bf9ecb44996f2c83236ff50b3812
tree18627395c7142c55282e0245c80a108bfcc8e07d
parent5d09ee1bec870263f4ace439402ea840503b503b
ipmi: Rework user message limit handling

The limit on the number of user messages had a number of issues,
improper counting in some cases and a use after free.

Restructure how this is all done to handle more in the receive message
allocation routine, so all refcouting and user message limit counts
are done in that routine.  It's a lot cleaner and safer.

Reported-by: Gilles BULOZ <gilles.buloz@kontron.com>
Closes: https://lore.kernel.org/lkml/aLsw6G0GyqfpKs2S@mail.minyard.net/
Fixes: 8e76741c3d8b ("ipmi: Add a limit on the number of users that may use IPMI")
Cc: <stable@vger.kernel.org> # 4.19
Signed-off-by: Corey Minyard <corey@minyard.net>
Tested-by: Gilles BULOZ <gilles.buloz@kontron.com>
drivers/char/ipmi/ipmi_msghandler.c