diff mbox

hw/prd: Fix handling of invlid message types

Message ID 1434514509.71245.758112581114.1.gpush@pablo
State Accepted
Headers show

Commit Message

Jeremy Kerr June 17, 2015, 4:15 a.m. UTC
If we get a prd_message_consumed callback from the opal_msg interface,
and it has an invalid message type, then we'll end up returning with the
events_lock held.

This really shouldn't happen (as we have handlers for all message types
that we queue), but we should still handle this gracefully. This change
fixes the error path to log and error and send any further queued
messages.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

---
 hw/prd.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/hw/prd.c b/hw/prd.c
index 87babd1..5487be5 100644
--- a/hw/prd.c
+++ b/hw/prd.c
@@ -113,10 +113,12 @@  static void prd_msg_consumed(void *data)
 		event = EVENT_OCC_RESET;
 		break;
 	default:
-		return;
+		prlog(PR_ERR, "PRD: invalid msg consumed, type: 0x%x\n",
+				msg->hdr.type);
 	}
 
-	events[proc] &= ~event;
+	if (event)
+		events[proc] &= ~event;
 	prd_msg_inuse = false;
 	send_pending_events();
 	unlock(&events_lock);