ipmi:ssif: Check for NULL msg when handling events and messages
authorCorey Minyard <cminyard@mvista.com>
Fri, 1 Apr 2022 12:44:53 +0000 (07:44 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Jun 2022 14:53:45 +0000 (16:53 +0200)
commite3d0eb39cfe9bd5bfac615b6420fe76ed2739c91
treea32cd2b3c1d07ce209487a53b2ff420866dc4fc8
parentd956fe6b3da0187a4374d5d7b22b1f1b543727a9
ipmi:ssif: Check for NULL msg when handling events and messages

[ Upstream commit 7602b957e2404e5f98d9a40b68f1fd27f0028712 ]

Even though it's not possible to get into the SSIF_GETTING_MESSAGES and
SSIF_GETTING_EVENTS states without a valid message in the msg field,
it's probably best to be defensive here and check and print a log, since
that means something else went wrong.

Also add a default clause to that switch statement to release the lock
and print a log, in case the state variable gets messed up somehow.

Reported-by: Haowen Bai <baihaowen@meizu.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/char/ipmi/ipmi_ssif.c