Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2901082iog; Mon, 27 Jun 2022 05:23:57 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uTtV/57ea8SBm6xHKyMO+j+PugPeZ5ByWvS1PWihBxOWuyN4wMGCdoddltQoLAJFhH8meq X-Received: by 2002:a17:903:120c:b0:167:8847:21f2 with SMTP id l12-20020a170903120c00b00167884721f2mr14027291plh.11.1656332637516; Mon, 27 Jun 2022 05:23:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656332637; cv=none; d=google.com; s=arc-20160816; b=QVztWY34XH+sxsqGm5ArddhKqZsLaNV/9QC8lABU9MpmOrD2/debsLLM94i4GxJLl8 oFrxaRzJ9MKhD6hBo5YlosIdcogFdX/bv1XtTrFR+E5lR/1rVyLvvsIDwdRCA5WXL5aW lWV7WG4N5iqitH5HKkwAHKaHfgqW+4Uwv4cboKC17LzoJNeg5CjyTkzw/s70HdSR08Cr HMGcO6WbYcUuzL/bpiZ9/3NohzJcRL9CMABTRAgphdomj5fIqZ9jqSgS73ooLsxzZgWU ajEI7soseXcFnBciO+szipXNDjbUpmWylhX9DzOQa+46liK+Q/HybwxbEs3vmzDtTMFg rAjw== 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=qeooZRpHIGrgmRBmUVf6v+6tyR2+e4EbEz5jjP06+uo=; b=J10up6RhIkUL2jj5Pt/9FIx1u52K2Dn9Fs7fWniK6HLM9x93+ukZn37vQ9a0JKNhuO Oaj1+8EozXKnBJNpKoG6ACmIzFsp9oCFDp2nirwNuOSLTf4gmo5RSMbnUHhmVKd3crFI KgPmVpfvhjEIlP/MoffW9gZuscDxKI5tVV/x0ubnWoI17yMLHs6jEotcUQJXy1PC8RAf So45C5NJuX4F4hv1Gn5Za8dGoFogan7P9NJDNnstpjPwCZXm+9UrZN2Cb5BH9SbOzyBU XOZf7qLhLM+19HRw3ImJ3R7fbc/MJ+GPQCUzBqubiQxetGslE0R8p/F0VIGfxKIDH0h8 2KSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="jnZO8d/f"; 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 pc11-20020a17090b3b8b00b001eaac606001si18061495pjb.118.2022.06.27.05.23.45; Mon, 27 Jun 2022 05:23:57 -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="jnZO8d/f"; 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 S235174AbiF0L36 (ORCPT + 99 others); Mon, 27 Jun 2022 07:29:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235177AbiF0L3E (ORCPT ); Mon, 27 Jun 2022 07:29:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35956A1A4; Mon, 27 Jun 2022 04:27:54 -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 C28DF614A0; Mon, 27 Jun 2022 11:27:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B19EBC3411D; Mon, 27 Jun 2022 11:27:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656329273; bh=6s4OzjVqP8fvyE022P86NPf+L24fKj2JE6MKYOT/My0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jnZO8d/fnhE7/rNrXFaDlZWgIIzN3G7/+oXVnhQkZjPM2qUAitinKtvsAjY5lowEQ 30nS02fu1G3urm94x958s3Czd39+Zd553YZqmig4qhEASw6l9EysxXH0FV2J4pw9Kc lsqT7UZnkMjW+9Xim6YEy5+axgixpCG7upIDpYcw= 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.10 090/102] powerpc/rtas: Allow ibm,platform-dump RTAS call with null buffer address Date: Mon, 27 Jun 2022 13:21:41 +0200 Message-Id: <20220627111936.135075465@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627111933.455024953@linuxfoundation.org> References: <20220627111933.455024953@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 @@ -1040,7 +1040,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 }, @@ -1087,6 +1087,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; }