From patchwork Wed Jun 17 04:15:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Kerr X-Patchwork-Id: 485278 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 29F30140290 for ; Wed, 17 Jun 2015 14:15:16 +1000 (AEST) Received: from ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 139321A0E2F for ; Wed, 17 Jun 2015 14:15:16 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [103.22.144.67]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id E5CCD1A0AD5 for ; Wed, 17 Jun 2015 14:15:12 +1000 (AEST) Received: by ozlabs.org (Postfix, from userid 1023) id CDE8B140290; Wed, 17 Jun 2015 14:15:12 +1000 (AEST) MIME-Version: 1.0 Message-Id: <1434514509.71245.758112581114.1.gpush@pablo> To: skiboot@lists.ozlabs.org From: Jeremy Kerr Date: Wed, 17 Jun 2015 12:15:09 +0800 Subject: [Skiboot] [PATCH] hw/prd: Fix handling of invlid message types X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" 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 --- hw/prd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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);