]> git.ipfire.org Git - thirdparty/linux.git/commit
ipmi:msghandler: Fix potential memory corruption in ipmi_create_user()
authorDan Carpenter <dan.carpenter@linaro.org>
Mon, 5 May 2025 14:34:15 +0000 (17:34 +0300)
committerCorey Minyard <corey@minyard.net>
Wed, 7 May 2025 22:25:48 +0000 (17:25 -0500)
commitfa332f5dc6fc662ad7d3200048772c96b861cf6b
tree073b885611338b20cef6c546c63d0f5d56907f20
parent971a00454d9604493ecfe4ca8fb8de0fad2863e3
ipmi:msghandler: Fix potential memory corruption in ipmi_create_user()

The "intf" list iterator is an invalid pointer if the correct
"intf->intf_num" is not found.  Calling atomic_dec(&intf->nr_users) on
and invalid pointer will lead to memory corruption.

We don't really need to call atomic_dec() if we haven't called
atomic_add_return() so update the if (intf->in_shutdown) path as well.

Fixes: 8e76741c3d8b ("ipmi: Add a limit on the number of users that may use IPMI")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Message-ID: <aBjMZ8RYrOt6NOgi@stanley.mountain>
Signed-off-by: Corey Minyard <corey@minyard.net>
drivers/char/ipmi/ipmi_msghandler.c