From patchwork Tue May 21 16:41:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Hesselbarth X-Patchwork-Id: 245340 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id B42B02C0211 for ; Wed, 22 May 2013 02:42:54 +1000 (EST) Received: from mail-ea0-x22e.google.com (mail-ea0-x22e.google.com [IPv6:2a00:1450:4013:c01::22e]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 17D952C00B9 for ; Wed, 22 May 2013 02:42:18 +1000 (EST) Received: by mail-ea0-f174.google.com with SMTP id z7so553287eaf.33 for ; Tue, 21 May 2013 09:42:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=tWNNlanFNVthTDmDsdMfOsKiO9G+mvNN/NZV6Jr6qPI=; b=BVudtCfC0HRE98z1fCUJ+N5v2qYYCl+3ifSXNAmrkavDPHS05y2ahPscpCxqlsSg39 RrufgFGJf7Puhse2EQ1iOo+R/FpVd0bBToq11zuvSITC5dama2ajT0+6VJxqnKr0CAxf WwHO9BKOpW+3PoSPnACT4uQOTZGodUr+Vt08qAf3DaD4thnbv8z0nm68DxqAadAZR7JU mm01st9wzK9hbYKSXJSt7zmGVybaZNy0UNxL8oS+ThKY628jUJKtTKaBNc8siiQu7VFf nuPXGSnwos3ndOa04zfgJr0MExvoO6MgempoF8O5NY2zRJ1oU7AZa7G+jOQn6PeXp20I M97w== X-Received: by 10.14.5.5 with SMTP id 5mr8466081eek.21.1369154534481; Tue, 21 May 2013 09:42:14 -0700 (PDT) Received: from topkick.lan (dslc-082-083-251-181.pools.arcor-ip.net. [82.83.251.181]) by mx.google.com with ESMTPSA id s8sm4678807eeo.4.2013.05.21.09.42.12 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 21 May 2013 09:42:13 -0700 (PDT) Received: from edge.wm.mst.uni-hannover.de (firewall.mst.uni-hannover.de [130.75.30.51]) by topkick.lan (Postfix) with ESMTPSA id 8E251605AA; Tue, 21 May 2013 18:41:25 +0200 (CEST) From: Sebastian Hesselbarth To: Sebastian Hesselbarth Subject: [PATCH v4 01/12] net: mv643xx_eth: use phy_disconnect instead of phy_detach Date: Tue, 21 May 2013 18:41:39 +0200 Message-Id: <1369154510-4927-2-git-send-email-sebastian.hesselbarth@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1369154510-4927-1-git-send-email-sebastian.hesselbarth@gmail.com> References: <1367854420-8006-1-git-send-email-sebastian.hesselbarth@gmail.com> <1369154510-4927-1-git-send-email-sebastian.hesselbarth@gmail.com> Cc: Andrew Lunn , Jason Cooper , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, David Miller , Lennert Buytenhek X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Using a separated mdio bus driver with mvmdio, phy_detach on network device removal will not stop the phy and finally lead to NULL pointer dereference in mvmdio due to non-existent network device. Use phy_disconnect instead to properly stop phy device from accessing network device prior removal of the network device. Signed-off-by: Sebastian Hesselbarth --- Note: I observed this behavior when removing a modular mv643xx_eth driver after attaching it to a phy handled by (also modular) mvmdio. The mvmdio conversion has been done in commit c3a07134e6aa5b93a37f72ffa3d11fadf72bf757 ("mv643xx_eth: convert to use the Marvell Orion MDIO driver") and should go back any -stable version with that commit (propably only 3.9) @David: I am not sure if the above description is sufficient for a -stable patch, if you need more, like actual kernel failure, I am sure I can reproduce it. Cc: David Miller Cc: Lennert Buytenhek Cc: Jason Cooper Cc: Andrew Lunn Cc: Benjamin Herrenschmidt Cc: netdev@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org --- drivers/net/ethernet/marvell/mv643xx_eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c index d0afeea..ef3454c 100644 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c @@ -2805,7 +2805,7 @@ static int mv643xx_eth_remove(struct platform_device *pdev) unregister_netdev(mp->dev); if (mp->phy != NULL) - phy_detach(mp->phy); + phy_disconnect(mp->phy); cancel_work_sync(&mp->tx_timeout_task); if (!IS_ERR(mp->clk))