Message ID | ZFmfxpsd8Fiqc7K_@pidgin.makrotopia.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2557878vqo; Mon, 8 May 2023 18:51:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ76ftEAXDED02LQKy4MVcxciXovvPrB4ckCE7VxwotYhngR7/LZNtvMIgqAQM190MmfX2gf X-Received: by 2002:a17:902:c102:b0:1ac:4735:45d7 with SMTP id 2-20020a170902c10200b001ac473545d7mr12036885pli.6.1683597069887; Mon, 08 May 2023 18:51:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683597069; cv=none; d=google.com; s=arc-20160816; b=Vh4oUXyshg00TmIhW4IoPf0rvRrQfxKMqHEDWOj/KASTxxTgGBhvUridrGFGiURWM2 o187bzV5Xtz5CF3Uwqk0RuOa9vuPyCYzUgUxFv2SK7V67iPMokTbkhBodrTCtmftdk5T NsR2fSkK8YTO9sc090uHGNyz3s0POsiya6rSYnHe3FHOo9gLXhi7sfVZWeKyIhmev5KM ZuaCRDwXqnEBCG8FS46HA35mbW1H7RC28H/2po/ELgK5KFEO0q2YwNHk3EQJy9AQrmV6 lTguxxzDa75Jz7rZWjJHETVX6/u5swF7gKoG23WQRFo7eQb4Nh3b8u5vyCNvgVHdQB0E SW2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:to:from:date; bh=zeqDFAMBKmoT/g81hl2hQIeucwKvcq8VOvv07+thxgU=; b=fZsOT1mgGPrmDMPileViHqJKijWaNoZVBu9KPMEAGYtNILQhirtA0Uk0xz4By4KNjK bgn/Uw0z1v6b9WA0dzFbjdUQuanOcAml3i8nFruE/BeFJv1npcQQBJBUy/D6vayCv1rk uVzU2/5F0yCbN9QEpnIjfOQyDIGs7ECtB/9IpmcphF+A7SRAnYtoTO2zVQQwEDfWOlIc epT1yNW5YF82zEQ2wDeWUYqrE1Lri0IJyywSqOW+RS1goNevLMf2mWIBFXtAKaDWLv4w GNuuKZBQoD6wUQ91d3/eNnFsB4vlohG16SO+hAP3pts/k76r0zSRX8t+LBMkOwjwD/Md HOxw== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d4-20020a170903230400b001ab1d1a6802si390320plh.1.2023.05.08.18.50.55; Mon, 08 May 2023 18:51:09 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229726AbjEIBgF (ORCPT <rfc822;jeantsuru.cumc.mandola@gmail.com> + 99 others); Mon, 8 May 2023 21:36:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230113AbjEIBgC (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 8 May 2023 21:36:02 -0400 X-Greylist: delayed 832 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 08 May 2023 18:36:00 PDT Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30B2D49D9; Mon, 8 May 2023 18:35:59 -0700 (PDT) Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from <daniel@makrotopia.org>) id 1pwC3G-00022c-03; Tue, 09 May 2023 01:22:02 +0000 Date: Tue, 9 May 2023 03:20:06 +0200 From: Daniel Golle <daniel@makrotopia.org> To: netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Felix Fietkau <nbd@nbd.name>, John Crispin <john@phrozen.org>, Sean Wang <sean.wang@mediatek.com>, Mark Lee <Mark-MC.Lee@mediatek.com>, Lorenzo Bianconi <lorenzo@kernel.org>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Matthias Brugger <matthias.bgg@gmail.com>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Subject: [PATCH net] net: ethernet: mtk_eth_soc: fix NULL pointer dereference Message-ID: <ZFmfxpsd8Fiqc7K_@pidgin.makrotopia.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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: <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?1765379481417836793?= X-GMAIL-MSGID: =?utf-8?q?1765379481417836793?= |
Series |
[net] net: ethernet: mtk_eth_soc: fix NULL pointer dereference
|
|
Commit Message
Daniel Golle
May 9, 2023, 1:20 a.m. UTC
Check for NULL pointer to avoid kernel crashing in case of missing WO
firmware in case only a single WEDv2 device has been initialized, e.g. on
MT7981 which can connect just one wireless frontend.
Fixes: 86ce0d09e424 ("net: ethernet: mtk_eth_soc: use WO firmware for MT7981")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
drivers/net/ethernet/mediatek/mtk_wed.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Tue, May 09, 2023 at 03:20:06AM +0200, Daniel Golle wrote: > Check for NULL pointer to avoid kernel crashing in case of missing WO > firmware in case only a single WEDv2 device has been initialized, e.g. on > MT7981 which can connect just one wireless frontend. > > Fixes: 86ce0d09e424 ("net: ethernet: mtk_eth_soc: use WO firmware for MT7981") > Signed-off-by: Daniel Golle <daniel@makrotopia.org> Reviewed-by: Simon Horman <simon.horman@corigine.com>
Hello: This patch was applied to netdev/net.git (main) by David S. Miller <davem@davemloft.net>: On Tue, 9 May 2023 03:20:06 +0200 you wrote: > Check for NULL pointer to avoid kernel crashing in case of missing WO > firmware in case only a single WEDv2 device has been initialized, e.g. on > MT7981 which can connect just one wireless frontend. > > Fixes: 86ce0d09e424 ("net: ethernet: mtk_eth_soc: use WO firmware for MT7981") > Signed-off-by: Daniel Golle <daniel@makrotopia.org> > > [...] Here is the summary with links: - [net] net: ethernet: mtk_eth_soc: fix NULL pointer dereference https://git.kernel.org/netdev/net/c/7c83e28f1083 You are awesome, thank you!
diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c index 4c205afbd230..985cff910f30 100644 --- a/drivers/net/ethernet/mediatek/mtk_wed.c +++ b/drivers/net/ethernet/mediatek/mtk_wed.c @@ -654,7 +654,7 @@ __mtk_wed_detach(struct mtk_wed_device *dev) BIT(hw->index), BIT(hw->index)); } - if (!hw_list[!hw->index]->wed_dev && + if ((!hw_list[!hw->index] || !hw_list[!hw->index]->wed_dev) && hw->eth->dma_dev != hw->eth->dev) mtk_eth_set_dma_device(hw->eth, hw->eth->dev);