From patchwork Thu Aug 10 06:58:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell Currey X-Patchwork-Id: 800105 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xSfBq6MX4z9s7M for ; Thu, 10 Aug 2017 16:59:31 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="GkEXzWnh"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3xSfBq5J7TzDqwr for ; Thu, 10 Aug 2017 16:59:31 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="GkEXzWnh"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3xSfBR4N0xzDqrx for ; Thu, 10 Aug 2017 16:59:11 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="GkEXzWnh"; dkim-atps=neutral Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 4D4D321B1F; Thu, 10 Aug 2017 02:59:06 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute6.internal (MEProxy); Thu, 10 Aug 2017 02:59:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=QsDL02 sciQkSFMfOM+ib78VrSP0ZXz9tQ6Qg+0e51k8=; b=GkEXzWnhQASkEBsMiSyofj bwtGo0YKhCwN7ix4GP/B7BbehvJffCfPZ56yA2yuythXCE5yOEJP5iTCFDr0cfUf lljovnstiV7OvgpooprmKtYUXdg9A8Bxw6YnxETu1colfaHVMOb+ElAkEEhdSlbQ mOWVVXbQjTRU9bSSjiW/2VlBVMYcMNt5B5XsRRIZ66KVfnrMMKGklFLGAL45tx4C 0EDoBlUXGeRSmue2ICWKCjnh1UPVQdMhJeXkcbAtPMd18gDTfDuSM7WTExqArg69 O3c0usxZQ24ZZsYimtZxlrWlN5/6/yqzalkpXBX3yOp66znEKyQ4iNArSoR1kjrQ == X-ME-Sender: X-Sasl-enc: 5iGdC5QRsXbMRgtIsD+mYRKskFuuqPtQ9DnBxku8u8JD 1502348345 Received: from snap.ozlabs.ibm.com (unknown [122.99.82.10]) by mail.messagingengine.com (Postfix) with ESMTPA id AF2C1246D5; Thu, 10 Aug 2017 02:59:04 -0400 (EDT) From: Russell Currey To: skiboot@lists.ozlabs.org Date: Thu, 10 Aug 2017 16:58:38 +1000 Message-Id: <20170810065843.13893-1-ruscur@russell.cc> X-Mailer: git-send-email 2.14.0 Subject: [Skiboot] [PATCH 1/6] xive: Check for valid PIR index when decoding X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mikey@neuling.org MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" This fixes an unlikely but possible assert() fail on kdump. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Russell Currey Reviewed-by: Andrew Donnellan Reviewed-by: Andrew Donnellan Reviewed-by: Andrew Donnellan Reviewed-by: Andrew Donnellan --- hw/xive.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/xive.c b/hw/xive.c index 03b9478e..18636723 100644 --- a/hw/xive.c +++ b/hw/xive.c @@ -601,6 +601,8 @@ static bool xive_decode_vp(uint32_t vp, uint32_t *blk, uint32_t *idx, /* PIR case */ if (((vp >> 30) & 1) == 0) { + if (find_cpu_by_pir(index) == NULL) + return false; if (blk) *blk = PIR2VP_BLK(index); if (idx) @@ -656,6 +658,8 @@ static bool xive_decode_vp(uint32_t vp, uint32_t *blk, uint32_t *idx, /* PIR case */ if (((vp >> 30) & 1) == 0) { + if (find_cpu_by_pir(index) == NULL) + return false; if (blk) *blk = PIR2VP_BLK(index); if (idx)