From mboxrd@z Thu Jan 1 00:00:00 1970 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.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 AC898C433DF for ; Mon, 29 Jun 2020 21:06:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 85410206A1 for ; Mon, 29 Jun 2020 21:06:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593464781; bh=H7Odf4Ro0q68TqmJ8ZLxfTKBiycrgRvyDAgRqObU90w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=HSsoGc688qtpNDWn6Y7YyHOLUZJPnjrDc7+282mIhhv9WgPJPaL/loMEeTvhEOteA OZGfF28opsjuOrYvSooawVAP7TbBXa+dJUcdUArsikNDn+1eBewpsZlRX5u1JHD/uB J9T3Ro+uvb71rvEYv8DIN+xsycVw8bc/YLAfsI1Y= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730692AbgF2TMl (ORCPT ); Mon, 29 Jun 2020 15:12:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:53730 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730965AbgF2TKS (ORCPT ); Mon, 29 Jun 2020 15:10:18 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8F198254CE; Mon, 29 Jun 2020 15:53:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593446027; bh=H7Odf4Ro0q68TqmJ8ZLxfTKBiycrgRvyDAgRqObU90w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b0aKJNAiOIeCplxtKmvDD0QLK7jqJX9hFV7/U6lzviw0+kWGE/UJo2LPbA4/ELxtw BnHnaQ6oMaHGhjNFhFJ8OzE+ZTdmdbzxqQJfIRGjexg3IPRuk/lip6+4U/igyKD7UV 7Dgl9pB26+2+qbKmwv7PwVgwh0exrs4CzDrmvgMg= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Nicholas Piggin , Michael Ellerman , Mahesh Salgaonkar , Sasha Levin Subject: [PATCH 4.4 033/135] powerpc/pseries/ras: Fix FWNMI_VALID off by one Date: Mon, 29 Jun 2020 11:51:27 -0400 Message-Id: <20200629155309.2495516-34-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200629155309.2495516-1-sashal@kernel.org> References: <20200629155309.2495516-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.229-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-4.4.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.4.229-rc1 X-KernelTest-Deadline: 2020-07-01T15:53+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit 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 9795e52bab3d3..9e817c1b78087 100644 --- a/arch/powerpc/platforms/pseries/ras.c +++ b/arch/powerpc/platforms/pseries/ras.c @@ -265,10 +265,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)))) /* * Get the error information for errors coming through the -- 2.25.1