Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2926537iog; Mon, 27 Jun 2022 05:56:48 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ujv5boRQpdOuRnHEOSjt8oxr6tChYpIjsEpEElQM+IKlzy7WeeEAvdebUvb9ogwVsJH2HH X-Received: by 2002:a05:6a00:230d:b0:4f6:ec4f:35ff with SMTP id h13-20020a056a00230d00b004f6ec4f35ffmr14932025pfh.53.1656334608281; Mon, 27 Jun 2022 05:56:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656334608; cv=none; d=google.com; s=arc-20160816; b=nR7IECdp1tp/5eCtRD7CbL3D0QSZo5vvtg3+JxgmfUSuzZij6007Su4ZsWZBPDDXhI Liwksn/L0GBytws4PXWlJPMDKzUzbwnYDTorgP4EJUeOGkXzyhRniQOS0kE1kdBFZvPZ YY53GzPgxAiZ9M0zqWpDH7xmGMuNCcosJ+B2BKozSHjy3eWEBaVovrc0xtc8VKJ1IOxB v+iEdYC9yjAUrKb7dQh70iHRxGKA8wj8rnRYc/sG9y6C+P95pmkH4U+E1+vIwaKrCTqH RpJV2TERGL/QMMww/thVwMsSmV2eZAXh2jd4/kJa6/3ggKkg23svH+6Zg2fGnNPdGK5C 97Nw== 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=fPVON9XRT8R/IdyFxNW5WiIXhk2T9e0nz2Z1OywWdpw=; b=HeagMZP5nPL1DMSj1fyyKOof6USZguU4UtEWas5wUSgpDxVMutsaJ8QnsL6tGEuzo7 QkA3hoarNvgoXN1y7QmiawJ5YiSXvFjfbB/wH8U/KVjC+hSaIGqtE0iP7+TTqNQJT2vm m/I7F82475j0qsDEQhDpyIbLLvqIV46kEkxpKCSP/6Zaa17JUZQuwiOjdc00p8iuFEIK HlCw+Ogw0r0UH/wgROO6khcTyPaYXlYv+TnPe6NGeOFOSBwYwcKzgQej/4md/xq7kXoH Fw6TtYqmIdCR8Q1QrHaV7nX8R2qg4fhZWpYH9fd5Wi1GaSYzxQOqblyUQAl8vF8tJ6uY eiMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rnRCI6fM; 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 q16-20020a170902f79000b0015827ec0073si14970423pln.452.2022.06.27.05.56.35; Mon, 27 Jun 2022 05:56:48 -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=rnRCI6fM; 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 S238887AbiF0Lx7 (ORCPT + 99 others); Mon, 27 Jun 2022 07:53:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238373AbiF0LsW (ORCPT ); Mon, 27 Jun 2022 07:48:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91856FD26; Mon, 27 Jun 2022 04:40: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 2545F611B8; Mon, 27 Jun 2022 11:40:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 354A7C36AE2; Mon, 27 Jun 2022 11:40:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656330057; bh=rtkociItVY4GySdFeYnZVICr5i00ah2LEMi002RbqO0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rnRCI6fMtiw2tiT3Pyj6w++XBn2nTP9HeT8mlFqXGz/VyXI7wj9L2rnPaZIutl+tn 80Ub27oV/fkQ6KTJqJKdDXBE4t4i1eb1smNCPuj3eG4gktUTsyzBcXAJED3k0cmP+N 6EdwkC+6xgp/d8kxLHn+gSvs5r9/XS2QoRJgiD0U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oleksij Rempel , Andrew Lunn , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 069/181] net: phy: at803x: fix NULL pointer dereference on AR9331 PHY Date: Mon, 27 Jun 2022 13:20:42 +0200 Message-Id: <20220627111946.565417165@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627111944.553492442@linuxfoundation.org> References: <20220627111944.553492442@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: Oleksij Rempel [ Upstream commit 9926de7315be3d606cc011a305ad9adb9e8e14c9 ] Latest kernel will explode on the PHY interrupt config, since it depends now on allocated priv. So, run probe to allocate priv to fix it. ar9331_switch ethernet.1:10 lan0 (uninitialized): PHY [!ahb!ethernet@1a000000!mdio!switch@10:00] driver [Qualcomm Atheros AR9331 built-in PHY] (irq=13) CPU 0 Unable to handle kernel paging request at virtual address 0000000a, epc == 8050e8a8, ra == 80504b34 ... Call Trace: [<8050e8a8>] at803x_config_intr+0x5c/0xd0 [<80504b34>] phy_request_interrupt+0xa8/0xd0 [<8050289c>] phylink_bringup_phy+0x2d8/0x3ac [<80502b68>] phylink_fwnode_phy_connect+0x118/0x130 [<8074d8ec>] dsa_slave_create+0x270/0x420 [<80743b04>] dsa_port_setup+0x12c/0x148 [<8074580c>] dsa_register_switch+0xaf0/0xcc0 [<80511344>] ar9331_sw_probe+0x370/0x388 [<8050cb78>] mdio_probe+0x44/0x70 [<804df300>] really_probe+0x200/0x424 [<804df7b4>] __driver_probe_device+0x290/0x298 [<804df810>] driver_probe_device+0x54/0xe4 [<804dfd50>] __device_attach_driver+0xe4/0x130 [<804dcb00>] bus_for_each_drv+0xb4/0xd8 [<804dfac4>] __device_attach+0x104/0x1a4 [<804ddd24>] bus_probe_device+0x48/0xc4 [<804deb44>] deferred_probe_work_func+0xf0/0x10c [<800a0ffc>] process_one_work+0x314/0x4d4 [<800a17fc>] worker_thread+0x2a4/0x354 [<800a9a54>] kthread+0x134/0x13c [<8006306c>] ret_from_kernel_thread+0x14/0x1c Same Issue would affect some other PHYs (QCA8081, QCA9561), so fix it too. Fixes: 3265f4218878 ("net: phy: at803x: add fiber support") Signed-off-by: Oleksij Rempel Reviewed-by: Andrew Lunn Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/phy/at803x.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 6a467e7817a6..59fe356942b5 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -2072,6 +2072,8 @@ static struct phy_driver at803x_driver[] = { /* ATHEROS AR9331 */ PHY_ID_MATCH_EXACT(ATH9331_PHY_ID), .name = "Qualcomm Atheros AR9331 built-in PHY", + .probe = at803x_probe, + .remove = at803x_remove, .suspend = at803x_suspend, .resume = at803x_resume, .flags = PHY_POLL_CABLE_TEST, @@ -2087,6 +2089,8 @@ static struct phy_driver at803x_driver[] = { /* Qualcomm Atheros QCA9561 */ PHY_ID_MATCH_EXACT(QCA9561_PHY_ID), .name = "Qualcomm Atheros QCA9561 built-in PHY", + .probe = at803x_probe, + .remove = at803x_remove, .suspend = at803x_suspend, .resume = at803x_resume, .flags = PHY_POLL_CABLE_TEST, @@ -2151,6 +2155,8 @@ static struct phy_driver at803x_driver[] = { PHY_ID_MATCH_EXACT(QCA8081_PHY_ID), .name = "Qualcomm QCA8081", .flags = PHY_POLL_CABLE_TEST, + .probe = at803x_probe, + .remove = at803x_remove, .config_intr = at803x_config_intr, .handle_interrupt = at803x_handle_interrupt, .get_tunable = at803x_get_tunable, -- 2.35.1