Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp653689iog; Thu, 30 Jun 2022 07:45:10 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t/27IZy4cQwc5Wu644n7QOz4gb+9E7SEiHzWd4u+FfrGxWMFOo5osp3LkNzRPUqx7P9Tu9 X-Received: by 2002:a17:906:4fc9:b0:726:f4e4:88e8 with SMTP id i9-20020a1709064fc900b00726f4e488e8mr9107582ejw.57.1656600310526; Thu, 30 Jun 2022 07:45:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656600310; cv=none; d=google.com; s=arc-20160816; b=ajfNMaFdfH3nr6funvJif0aWGpgUADlDKPfAe/yMXkiHSZfs+p6vtefOqIdikYaN0Q p7HhpL3Ah504qVN9mkHbXRpDbTlUkzhQBbR8IjZnPmcCIDFNtQ8fpHwy47sZEH1Hdxq/ 47Y8rwLKvgnh7MaU7o887j6xFlqhplYJWASuGfEtgz6ZdKySMk7MUlA9SL1q5kwFPKKA hVWp8eHz4aGr1qDXHGLBwhtpaKwc1A4rl7SeCfGLrieJZd2Oo41Lr2o0GoKuYbg8atr+ isLaqw9yNchQnqrnldhVAcnzF32ZKWfsTyDA8g3snkgqh8WLkiGNaSy4/jEc6cprII9g RQtA== 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=OhAJ8CheHFJjA4IxfhVri2alYV83e+z9SetsXsK9rS4=; b=FPw2vscbfbocKpCLCR73g0MTyKCdp75oyvVFR/47pDk2Zyo2X4GuMIjvej1xoiI30X br8MMyKQlRHYuiWEwPio+CylqKmvZcxAA7Uth2dKJZmtrr7s3YxDAOlIAxODO7p4nmTO wdcfOoKiIObxwUm2IqVzWJnDPUpvjZoBNIH7x+BVEJCVb2UJL+WnLE5GWZ0l+dllQfCb VUSzuYRiBS2YEfqlWnshudzyK61Hn4hIfCPu8m/ZR0CGV8rU8MY6nprRn8tA2p1Oupei huywyIM1LO0KtEM0v2uiIs6ZNcxEED9B64mXnBBTCXrpJePOC0cMzGZ0GVcHoaN7iyug JwFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wGaVUJ7q; 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 ht12-20020a170907608c00b006ff21848071si106457ejc.637.2022.06.30.07.44.45; Thu, 30 Jun 2022 07:45:10 -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=wGaVUJ7q; 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 S236287AbiF3OA6 (ORCPT + 99 others); Thu, 30 Jun 2022 10:00:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236567AbiF3N7L (ORCPT ); Thu, 30 Jun 2022 09:59:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57BE942A16; Thu, 30 Jun 2022 06:51:58 -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 6276761FDB; Thu, 30 Jun 2022 13:51:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70A5DC34115; Thu, 30 Jun 2022 13:51:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656597116; bh=yDKIfKcX24yBIYaS0ER4IhweXDKsRCSF3+Lp+lb3ado=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wGaVUJ7qck4P2vNxXHfYszRsXzQ331PS5rq+CJtqLfXonWEsyLICMRDr0GQ6BLu3g jvD4hpXfIcimU8/leZtP6jfxBlOcezoukIEhyjeK+CPmn8UeqDCYhTiVYmGBJ8mcVr sdlsOEB3UfDRvyIlG8jsGPyUQAnkjq+7YBRZjca4= 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 4.19 33/49] powerpc/rtas: Allow ibm,platform-dump RTAS call with null buffer address Date: Thu, 30 Jun 2022 15:46:46 +0200 Message-Id: <20220630133234.862929190@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220630133233.910803744@linuxfoundation.org> References: <20220630133233.910803744@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 @@ -1105,7 +1105,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 }, @@ -1152,6 +1152,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; }