Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2957731rwb; Fri, 11 Nov 2022 18:36:31 -0800 (PST) X-Google-Smtp-Source: AA0mqf7Hb3JDhcv/TUYrOhMNrd6LjR3nHhaZ0B/+imZ1M/wI7OHXmISVn+qECoR4+rHpngcmMZAJ X-Received: by 2002:a05:6a00:991:b0:571:baf8:8945 with SMTP id u17-20020a056a00099100b00571baf88945mr3872116pfg.83.1668220591131; Fri, 11 Nov 2022 18:36:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668220591; cv=none; d=google.com; s=arc-20160816; b=k1LUM7W9lUTchZimZqjRzo/uUPPlA2Br/3MRhIemYBImz57IEl43cJJznycW0qr0QF 3wpli6PCMJ229RwdMHoGHKKVItyL8K6tY0xh13frzBnALOoKR9T2jOzIKfuPxiNZMU8f 8eBjWXsahz4qlcRUmnTCctGtWP1A56Onw7XWujRKiY2odoKFVUdWo34VwK2Vos4x5+eY 9zcnWtyS/nQX31q5eZu9ccwy68oBNLuHMZAQmEX2MbuuWvI70wACWo4KVZA2X3e7KqKq YC22ENIZcA6uF7t3vsmgDfAoK9NN2FygkdIJ/aH1yPDMTMlx34RS5LWNVivXuxpeiNS9 USmA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=rVxZYWZc6OKNj0YF+qExQKfe95v/Myu8soxzCcM5goA=; b=qYEHtXASIsnPwup3+r8KovjOpqUyiy441x/nUqJphB+2bLtS1BJ48e+J/kNSvPOhkI DSmjiqXi134Mogo2pkX3625sCQ//ph7/XSOY6FaASOL1mWO6przGolUN3e3vifRGi+zK QllBAE6pBOFmq+s1W1opyECYH6Fs3NRKuzllCBXM1SYZH3GnyztH/Li+R7WP6ufHbF2x WRRjXD+XCaBlcqHa3SSlLSdntnenNyDQBJPYue9G0zCv2OEn50cBNDaH/7BznHuw9vgg 8CIVyXd7TqtFamUabrl2lvIOQGjv0gcFOB+A7bsfOIx8xn4dEm0+tuQplm4wiM640syS /Nhw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s2-20020a63ff42000000b0043aebb63fc6si4190958pgk.81.2022.11.11.18.36.19; Fri, 11 Nov 2022 18:36:31 -0800 (PST) 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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234412AbiKLCH7 (ORCPT + 91 others); Fri, 11 Nov 2022 21:07:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234163AbiKLCHz (ORCPT ); Fri, 11 Nov 2022 21:07:55 -0500 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 794AF6B381; Fri, 11 Nov 2022 18:07:52 -0800 (PST) Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4N8Jqn5Zdpz15MPC; Sat, 12 Nov 2022 10:07:33 +0800 (CST) Received: from kwepemm600004.china.huawei.com (7.193.23.242) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sat, 12 Nov 2022 10:07:43 +0800 Received: from localhost.localdomain (10.28.79.22) by kwepemm600004.china.huawei.com (7.193.23.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sat, 12 Nov 2022 10:07:42 +0800 From: Huisong Li To: , CC: , , , , , , , , , , , Subject: [PATCH V3 2/2] mailbox: pcc: Reset pcc_chan_count to zero in case of PCC probe failure Date: Sat, 12 Nov 2022 10:05:28 +0800 Message-ID: <20221112020528.7837-3-lihuisong@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20221112020528.7837-1-lihuisong@huawei.com> References: <20221110015034.7943-1-lihuisong@huawei.com> <20221112020528.7837-1-lihuisong@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600004.china.huawei.com (7.193.23.242) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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 Currently, 'pcc_chan_count' is remains set to a non-zero value if PCC subspaces are parsed successfully but something else fail later during the initial PCC probing phase. This will result in pcc_mbox_request_channel trying to access the resources that are not initialised or allocated and may end up in a system crash. Reset pcc_chan_count to 0 when the PCC probe fails in order to prevent the possible issue as described above. Fixes: ce028702ddbc ("mailbox: pcc: Move bulk of PCCT parsing into pcc_mbox_probe") Signed-off-by: Huisong Li Reviewed-by: Sudeep Holla --- drivers/mailbox/pcc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c index 3c2bc0ca454c..105d46c9801b 100644 --- a/drivers/mailbox/pcc.c +++ b/drivers/mailbox/pcc.c @@ -743,6 +743,7 @@ static int __init pcc_init(void) if (IS_ERR(pcc_pdev)) { pr_debug("Err creating PCC platform bundle\n"); + pcc_chan_count = 0; return PTR_ERR(pcc_pdev); } -- 2.22.0