Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2906372iog; Mon, 27 Jun 2022 05:30:55 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sip7Sk6hr/mCiT0NTxClZQCz6O3SBorjt9bZyp1ZeFlgWPaGPNoX7JHZOHes3am+CBdubS X-Received: by 2002:a05:6402:524c:b0:437:8bb6:7e89 with SMTP id t12-20020a056402524c00b004378bb67e89mr7725214edd.153.1656333055196; Mon, 27 Jun 2022 05:30:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656333055; cv=none; d=google.com; s=arc-20160816; b=jeQqP0JRXUTicXNLx0yaPl+8cjYewRrM/OFrmXInlc9c7d8E7ArRMn8fu6pjqJJsAt pb9+DAtXu5Yjkjxe8tBXUm9Jq3J+nHbrCe2h628decCbexgitQcYmn24nz7c2xCWNJzO wC/fnAiuOAsJvwcuh2RbwbKSTf33KpqNpz9xBPwFAPk8DLX4iJGsAA1SnD1KUHcONYqO sCCX/QVit24VAEcCWU+ilTQD53RSxoM4kEKrYdbDFDldo12fbYyMtOjfTVt08wwA+9hW K+owVt80vMyU2Wqle5akfZfT8TfUIsE4QXwIamTu/Px5iv4Ly5IDWlytzX7VFBsINvYT 9B6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jQ5b7KygP9VSql35rupJTizYtyLdFcROB5gXLMengHk=; b=ewdPvTE6A3OVBoqn/qPJEchaNBTV0gJXfXTPtVk8EBSGNZuumdkigXYYwi4IfBIgpS OJd0fkzP3UeoYIFDS7+tCqjev3ulj3B7V9nBQQghWfFRTtyNtzxdTnxRBtVkou2PT5U5 CdjQp/hnmAQoCCqg4mX1qgW4JgYcKMtKYPrL0JaoZ/6DKVaMrNCOmOQCqU8sR7WA360E oumHhcJReU8LFfLrZH3Xfmvgv69khwfM9jQCeplxA+KJuww4RKstZvawZNyr633HZ8xO uXLxbzIXB2ziAhzrPIQYmyRNzKbbWUNsaDVWDqi+8YXhepXxDCX893Vy1bCWVXIdzei7 HG7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KGobKaAq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa7-20020a1709076d0700b00722e49d52c1si9200349ejc.564.2022.06.27.05.30.29; Mon, 27 Jun 2022 05:30:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KGobKaAq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235334AbiF0LfQ (ORCPT + 99 others); Mon, 27 Jun 2022 07:35:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236297AbiF0Lde (ORCPT ); Mon, 27 Jun 2022 07:33:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4660DE85; Mon, 27 Jun 2022 04:30:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 38D0F612D8; Mon, 27 Jun 2022 11:30:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47DE0C3411D; Mon, 27 Jun 2022 11:30:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656329450; bh=kkt3gAkpk4zSt5RnRBLPq4ddCp0djTQjV7HBZwGkRQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KGobKaAqFvrsExtmcMeKl6MhmHpiLfwOzTOXw/5Z6gtwhCRbWohYJnlU24+1qiP3R eTKx02eS3DWx0u3GUPCzoqOh9B46fl0ZCi8r7rIaZ/BRa58ffhJO5fPt6RnjhXgdtm BOjOr1fQp8s+VfdMHn+e7Haz8pZ4ENsUwUYQ5n10= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sathvika Vasireddy , Andrew Donnellan , Tyrel Datwyler , Nathan Lynch , Michael Ellerman Subject: [PATCH 5.4 50/60] powerpc/rtas: Allow ibm,platform-dump RTAS call with null buffer address Date: Mon, 27 Jun 2022 13:22:01 +0200 Message-Id: <20220627111929.162390729@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627111927.641837068@linuxfoundation.org> References: <20220627111927.641837068@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrew Donnellan commit 7bc08056a6dabc3a1442216daf527edf61ac24b6 upstream. Add a special case to block_rtas_call() to allow the ibm,platform-dump RTAS call through the RTAS filter if the buffer address is 0. According to PAPR, ibm,platform-dump is called with a null buffer address to notify the platform firmware that processing of a particular dump is finished. Without this, on a pseries machine with CONFIG_PPC_RTAS_FILTER enabled, an application such as rtas_errd that is attempting to retrieve a dump will encounter an error at the end of the retrieval process. Fixes: bd59380c5ba4 ("powerpc/rtas: Restrict RTAS requests from userspace") Cc: stable@vger.kernel.org Reported-by: Sathvika Vasireddy Signed-off-by: Andrew Donnellan Reviewed-by: Tyrel Datwyler Reviewed-by: Nathan Lynch Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220614134952.156010-1-ajd@linux.ibm.com Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kernel/rtas.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) --- a/arch/powerpc/kernel/rtas.c +++ b/arch/powerpc/kernel/rtas.c @@ -988,7 +988,7 @@ static struct rtas_filter rtas_filters[] { "get-time-of-day", -1, -1, -1, -1, -1 }, { "ibm,get-vpd", -1, 0, -1, 1, 2 }, { "ibm,lpar-perftools", -1, 2, 3, -1, -1 }, - { "ibm,platform-dump", -1, 4, 5, -1, -1 }, + { "ibm,platform-dump", -1, 4, 5, -1, -1 }, /* Special cased */ { "ibm,read-slot-reset-state", -1, -1, -1, -1, -1 }, { "ibm,scan-log-dump", -1, 0, 1, -1, -1 }, { "ibm,set-dynamic-indicator", -1, 2, -1, -1, -1 }, @@ -1035,6 +1035,15 @@ static bool block_rtas_call(int token, i size = 1; end = base + size - 1; + + /* + * Special case for ibm,platform-dump - NULL buffer + * address is used to indicate end of dump processing + */ + if (!strcmp(f->name, "ibm,platform-dump") && + base == 0) + return false; + if (!in_rmo_buf(base, end)) goto err; }