[PATCH] ipmi/powernv: Fix a minor bug

Neelesh Gupta neelegup at linux.vnet.ibm.com
Wed Jul 8 16:27:28 AEST 2015

If the OPAL call to receive the ipmi message fails, then we free up the smi
message before returning. But, the driver still holds the reference to old
smi message in the 'cur_msg' which is dangerous if the driver derefernces it
later and it will further block the subsequent ipmi operations. So, to fix
it up, we need to nullify 'cur_msg' in the error case.

Signed-off-by: Neelesh Gupta <neelegup at linux.vnet.ibm.com>
 drivers/char/ipmi/ipmi_powernv.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/char/ipmi/ipmi_powernv.c b/drivers/char/ipmi/ipmi_powernv.c
index 9b409c0..08dd38f 100644
--- a/drivers/char/ipmi/ipmi_powernv.c
+++ b/drivers/char/ipmi/ipmi_powernv.c
@@ -143,6 +143,7 @@ static int ipmi_powernv_recv(struct ipmi_smi_powernv *smi)
 	pr_devel("%s:   -> %d (size %lld)\n", __func__,
 			rc, rc == 0 ? size : 0);
 	if (rc) {
+		smi->cur_msg = NULL;
 		spin_unlock_irqrestore(&smi->msg_lock, flags);
 		return 0;

More information about the Linuxppc-dev mailing list