From patchwork Tue Jun 23 19:55:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 223222 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1096FC433E0 for ; Tue, 23 Jun 2020 21:16:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D61DC20702 for ; Tue, 23 Jun 2020 21:16:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592947014; bh=VWU426DXZAPMEsFxYMkP3Is4LUEnclJv/CRfjw7x26Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=q/rNuic0OepnXB/wDKFkfNtMrZYCFzU+irJ5s/s+a+sb3nBPun3p1O0nMhUbq+Z1c v0193mCHWBVSZ6Gwk09tOFIRunaUP5V+8xyEePiIzDbHwy/qLyBCG6se0tF5WMjwLM hp2c3R9M6JMWFQlWi8WkjxN5s9UXyeq4fWHb5aVw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391169AbgFWVQj (ORCPT ); Tue, 23 Jun 2020 17:16:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:46872 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390760AbgFWU1V (ORCPT ); Tue, 23 Jun 2020 16:27:21 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 45694206C3; Tue, 23 Jun 2020 20:27:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592944040; bh=VWU426DXZAPMEsFxYMkP3Is4LUEnclJv/CRfjw7x26Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=glZ/zSKvq+5ebh3Mi+HeWoCeKONEgLdSWpiQNWtkbAFh4ah9BefPj+IS3swvph8jB lI5RBRd/ClF64fIYFSkeftn8SQiKeoiWqi+rY9PQUXsVBg6fPpPQ9+s76W0My46fiW mkiS2JP8zewX3lu0fDJanxwURUsEA/RNIaPOozbQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Piggin , Michael Ellerman , Mahesh Salgaonkar , Sasha Levin Subject: [PATCH 5.4 149/314] powerpc/pseries/ras: Fix FWNMI_VALID off by one Date: Tue, 23 Jun 2020 21:55:44 +0200 Message-Id: <20200623195345.964617992@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623195338.770401005@linuxfoundation.org> References: <20200623195338.770401005@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Nicholas Piggin [ Upstream commit deb70f7a35a22dffa55b2c3aac71bc6fb0f486ce ] This was discovered developing qemu fwnmi sreset support. This off-by-one bug means the last 16 bytes of the rtas area can not be used for a 16 byte save area. It's not a serious bug, and QEMU implementation has to retain a workaround for old kernels, but it's good to tighten it. Signed-off-by: Nicholas Piggin Signed-off-by: Michael Ellerman Acked-by: Mahesh Salgaonkar Link: https://lore.kernel.org/r/20200508043408.886394-7-npiggin@gmail.com Signed-off-by: Sasha Levin --- arch/powerpc/platforms/pseries/ras.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c index 753adeb624f23..13ef77fd648f4 100644 --- a/arch/powerpc/platforms/pseries/ras.c +++ b/arch/powerpc/platforms/pseries/ras.c @@ -395,10 +395,11 @@ static irqreturn_t ras_error_interrupt(int irq, void *dev_id) /* * Some versions of FWNMI place the buffer inside the 4kB page starting at * 0x7000. Other versions place it inside the rtas buffer. We check both. + * Minimum size of the buffer is 16 bytes. */ #define VALID_FWNMI_BUFFER(A) \ - ((((A) >= 0x7000) && ((A) < 0x7ff0)) || \ - (((A) >= rtas.base) && ((A) < (rtas.base + rtas.size - 16)))) + ((((A) >= 0x7000) && ((A) <= 0x8000 - 16)) || \ + (((A) >= rtas.base) && ((A) <= (rtas.base + rtas.size - 16)))) static inline struct rtas_error_log *fwnmi_get_errlog(void) {