From patchwork Wed Sep 11 14:40:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sverdlin, Alexander" X-Patchwork-Id: 13800729 X-Patchwork-Delegate: kuba@kernel.org Received: from mta-64-226.siemens.flowmailer.net (mta-64-226.siemens.flowmailer.net [185.136.64.226]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0254B185954 for ; Wed, 11 Sep 2024 14:42:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.136.64.226 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726065751; cv=none; b=BFeIV4VcXMfp+SRGDYOjG0TdNJX+zxmZYY5KThJFVObsRPdI1mtorUk1ZwVFYZ+usEwDEtVWcuOAPKdM+AO5UyW6wvCaOYWUR0OFDmvhKfmcMF8Nes4TqwouCeB+yeZSHBWQyRA0tSfXJF8Bi2En/LpQ79lV5c7ctAIJJu8AVy0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726065751; c=relaxed/simple; bh=f/128AteF2svPgXo8CH8dthfp+5ydTjymU4vIkiJJe8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=btUXN0GSTnIrFrTyv9jI1bDULxXku1PuUfQhUHfyZ5Rb9TBOb706+5IrVTUROqGResdsiw2Z7+xfvNdYq2UXpYBxGi+aUDLVIypa4PSN3pL9LoHhxaI8dvSkUARPWtbW5RkmTlZX/DJvuofZ4Z3DtayrOehO3ATpVmnsSSI2scI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=siemens.com; spf=pass smtp.mailfrom=rts-flowmailer.siemens.com; dkim=pass (2048-bit key) header.d=siemens.com header.i=alexander.sverdlin@siemens.com header.b=eizSyDBx; arc=none smtp.client-ip=185.136.64.226 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=siemens.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rts-flowmailer.siemens.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=siemens.com header.i=alexander.sverdlin@siemens.com header.b="eizSyDBx" Received: by mta-64-226.siemens.flowmailer.net with ESMTPSA id 20240911144216dfe4d20b3a79e61a59 for ; Wed, 11 Sep 2024 16:42:16 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=alexander.sverdlin@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc; bh=c9PcQZFfNdq8cUu9sqpnFLswW6Zin2UTvho5Wq+tuEE=; b=eizSyDBxVpSvjni1XMMj6PhpkbTUBjCbkU/8EclL0rc/j2HAXGp6cFI5VV6J9NsnFZ65Ff Rs2XfVJLw04GNsVDnkIUVXLS0Q08s2MFeADXPip+FUkIstZDVp03Xyrk6XWKM3C8K+YvmVK2 JHzWHkIbhsA6iFJZWT24DnqS0YoqqFLICVAPud3Vu4J8z0zbQRNHa5EGMvyUr7/lHPZ7LrKt ukm4xi/CXhO5KFDOMaKfeFfFg4JzgW+rLWN8/F90RXny/Tp9XbsDqSI2/wvSGVCiDw5ZT/oT VLUtQUfANBzjBNmVCspZj6VGRUQAwuBgQgQEzMgNVhRvioB7i5oRHzrg==; From: "A. Sverdlin" To: netdev@vger.kernel.org Cc: Alexander Sverdlin , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , stable@vger.kernel.org Subject: [PATCH net] net: dsa: lan9303: avoid dsa_switch_shutdown() Date: Wed, 11 Sep 2024 16:40:03 +0200 Message-ID: <20240911144006.48481-1-alexander.sverdlin@siemens.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-456497:519-21489:flowmailer X-Patchwork-Delegate: kuba@kernel.org From: Alexander Sverdlin dsa_switch_shutdown() doesn't bring down any ports, but only disconnects slaves from master. Packets still come afterwards into master port and the ports are being polled for link status. This leads to crashes: Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 CPU: 0 PID: 442 Comm: kworker/0:3 Tainted: G O 6.1.99+ #1 Workqueue: events_power_efficient phy_state_machine pc : lan9303_mdio_phy_read lr : lan9303_phy_read Call trace: lan9303_mdio_phy_read lan9303_phy_read dsa_slave_phy_read __mdiobus_read mdiobus_read genphy_update_link genphy_read_status phy_check_link_status phy_state_machine process_one_work worker_thread Call lan9303_remove() instead to really unregister all ports before zeroing drvdata and dsa_ptr. Fixes: 0650bf52b31f ("net: dsa: be compatible with masters which unregister on shutdown") Cc: stable@vger.kernel.org Signed-off-by: Alexander Sverdlin Reviewed-by: Alexander Sverdlin Tested-by: Alexander Sverdlin --- drivers/net/dsa/lan9303-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c index 268949939636..ecd507355f51 100644 --- a/drivers/net/dsa/lan9303-core.c +++ b/drivers/net/dsa/lan9303-core.c @@ -1477,7 +1477,7 @@ EXPORT_SYMBOL(lan9303_remove); void lan9303_shutdown(struct lan9303 *chip) { - dsa_switch_shutdown(chip->ds); + lan9303_remove(chip); } EXPORT_SYMBOL(lan9303_shutdown);