Message ID | 20221115044632.181769-1-tanghui20@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2519717wru; Mon, 14 Nov 2022 20:53:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Pci1tNm9fMPbmY+/33YWu2GNEeagRS0k3NURA0Px0Q9M85FirlNbnYqeuhHEHHltRxR9H X-Received: by 2002:a17:906:7ca:b0:7ad:934e:95d3 with SMTP id m10-20020a17090607ca00b007ad934e95d3mr12420525ejc.393.1668487983220; Mon, 14 Nov 2022 20:53:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668487983; cv=none; d=google.com; s=arc-20160816; b=fOqh6df10fGc9AyNXdcjoAvyl7hO+eUenVTef+lPXZ0sxZC+G25Z8wjyECuEui2t/c UPmHly8lkoXrb7gzqT6Lw8rlKO3rGMKZ27kkhFIU+u0zUja5blZR/DxiBY2aUPmBBf9A O6wluOtB9OwpqkU1dkjhiaqSXPBMWbuTi5CzEVw3f070fhzvm4R1I8sSlWuXbxnjZSfo okOl1D4MDW49IaWkXuPrbl8iw6/B29CE9YPi12JH/47DPc6z84cYotV1gp5UdSqxf4rd SUSYFcIs7Kbst0V7aWc5GUrS0xobgepsCi1z7r9D79Ui54Zfq3PApE/X5C/aX8UgsiEi Kcsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=BIPK6iAl23RluRd2L6JenRYj77stu3001Xi2K0fa7Mk=; b=xmt3zh9tGdY1vS6a5PWTncgJhRlPqVFLfsTvIanUsSDaSFUEA/ClkL5+RlK7YjRmNI Ge8eOz0m6P47pPs0Y/AeJYZc3SBSCiawG7dL9nP7ZF8rdtUB9JdoWZ62AxM5r7iYhI2u /e5wGbrED6eRVG5tEiQ8kS1rmvnolf30AFqMGju7jso120E9eoig3IqudeU+yQ1uGZGF ex8Ja9IB0UjwzkJJACy+kAkTp1LSAHG51jG+QAdg8Lti6H2vfuvDR8/M9Q1cGA7EmMuF osDd6DTj3s5+WyN3TvUfB1pZmtPVNdcoY3D8C2etSedqCUaz/Sy2AuNI6nGaCf7Q1zcn owKA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ds5-20020a170907724500b007a7a3b40920si9379511ejc.995.2022.11.14.20.52.39; Mon, 14 Nov 2022 20:53:03 -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 S231169AbiKOEtw (ORCPT <rfc822;zwp10758@gmail.com> + 99 others); Mon, 14 Nov 2022 23:49:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229872AbiKOEtu (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 14 Nov 2022 23:49:50 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D185412A85; Mon, 14 Nov 2022 20:49:47 -0800 (PST) Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NBDCC2y17zqSMd; Tue, 15 Nov 2022 12:45:59 +0800 (CST) Received: from kwepemm600005.china.huawei.com (7.193.23.191) 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; Tue, 15 Nov 2022 12:49:45 +0800 Received: from ubuntu1804.huawei.com (10.67.175.30) by kwepemm600005.china.huawei.com (7.193.23.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 15 Nov 2022 12:49:45 +0800 From: Hui Tang <tanghui20@huawei.com> To: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>, <mw@semihalf.com>, <linux@armlinux.org.uk> CC: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <yusongping@huawei.com> Subject: [PATCH] net: mvpp2: fix possible invalid pointer dereference Date: Tue, 15 Nov 2022 12:46:32 +0800 Message-ID: <20221115044632.181769-1-tanghui20@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.175.30] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600005.china.huawei.com (7.193.23.191) 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749536455467972152?= X-GMAIL-MSGID: =?utf-8?q?1749536455467972152?= |
Series |
net: mvpp2: fix possible invalid pointer dereference
|
|
Commit Message
Hui Tang
Nov. 15, 2022, 4:46 a.m. UTC
It will cause invalid pointer dereference to priv->cm3_base behind,
if PTR_ERR(priv->cm3_base) in mvpp2_get_sram().
Fixes: a59d354208a7 ("net: mvpp2: enable global flow control")
Signed-off-by: Hui Tang <tanghui20@huawei.com>
---
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Tue, Nov 15, 2022 at 12:46:32PM +0800, Hui Tang wrote: > It will cause invalid pointer dereference to priv->cm3_base behind, > if PTR_ERR(priv->cm3_base) in mvpp2_get_sram(). > > Fixes: a59d354208a7 ("net: mvpp2: enable global flow control") > Signed-off-by: Hui Tang <tanghui20@huawei.com> > --- > drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c > index d98f7e9a480e..c92bd1922421 100644 > --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c > +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c > @@ -7421,7 +7421,7 @@ static int mvpp2_probe(struct platform_device *pdev) > dev_warn(&pdev->dev, "Fail to alloc CM3 SRAM\n"); > > /* Enable global Flow Control only if handler to SRAM not NULL */ > - if (priv->cm3_base) > + if (!IS_ERR_OR_NULL(priv->cm3_base)) > priv->global_tx_fc = true; The change is ok, but the patch title should include target, in your case it is net -> [PATCH net] .... Thanks > } > > -- > 2.17.1 >
On 2022/11/15 16:42, Leon Romanovsky wrote: > On Tue, Nov 15, 2022 at 12:46:32PM +0800, Hui Tang wrote: >> It will cause invalid pointer dereference to priv->cm3_base behind, >> if PTR_ERR(priv->cm3_base) in mvpp2_get_sram(). >> >> Fixes: a59d354208a7 ("net: mvpp2: enable global flow control") >> Signed-off-by: Hui Tang <tanghui20@huawei.com> >> --- >> drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c >> index d98f7e9a480e..c92bd1922421 100644 >> --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c >> +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c >> @@ -7421,7 +7421,7 @@ static int mvpp2_probe(struct platform_device *pdev) >> dev_warn(&pdev->dev, "Fail to alloc CM3 SRAM\n"); >> >> /* Enable global Flow Control only if handler to SRAM not NULL */ >> - if (priv->cm3_base) >> + if (!IS_ERR_OR_NULL(priv->cm3_base)) >> priv->global_tx_fc = true; > > The change is ok, but the patch title should include target, in your > case it is net -> [PATCH net] .... Thanks, I will fix it in v2.
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index d98f7e9a480e..c92bd1922421 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -7421,7 +7421,7 @@ static int mvpp2_probe(struct platform_device *pdev) dev_warn(&pdev->dev, "Fail to alloc CM3 SRAM\n"); /* Enable global Flow Control only if handler to SRAM not NULL */ - if (priv->cm3_base) + if (!IS_ERR_OR_NULL(priv->cm3_base)) priv->global_tx_fc = true; }