From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39B9AC433EF for ; Tue, 15 Mar 2022 05:44:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234829AbiCOFpZ (ORCPT ); Tue, 15 Mar 2022 01:45:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345017AbiCOFpV (ORCPT ); Tue, 15 Mar 2022 01:45:21 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D99936E34 for ; Mon, 14 Mar 2022 22:44:09 -0700 (PDT) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nTzyW-0002KH-K4; Tue, 15 Mar 2022 06:44:04 +0100 Received: from ore by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1nTzyV-0007cT-3y; Tue, 15 Mar 2022 06:44:03 +0100 Date: Tue, 15 Mar 2022 06:44:03 +0100 From: Oleksij Rempel To: Andrew Lunn Cc: Lukas Wunner , Oliver Neukum , Oleksij Rempel , "netdev@vger.kernel.org" , Heiner Kallweit Subject: Re: ordering of call to unbind() in usbnet_disconnect Message-ID: <20220315054403.GA14588@pengutronix.de> References: <62b944a1-0df2-6e81-397c-6bf9dea266ef@suse.com> <20220310113820.GG15680@pengutronix.de> <20220314184234.GA556@wunner.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 06:26:56 up 94 days, 14:12, 65 users, load average: 0.00, 0.06, 0.08 User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: netdev@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Mon, Mar 14, 2022 at 08:14:36PM +0100, Andrew Lunn wrote: > On Mon, Mar 14, 2022 at 07:42:34PM +0100, Lukas Wunner wrote: > > [cc += Heiner Kallweit, Andrew Lunn] > > > > On Thu, Mar 10, 2022 at 12:38:20PM +0100, Oleksij Rempel wrote: > > > On Thu, Mar 10, 2022 at 12:25:08PM +0100, Oliver Neukum wrote: > > > > I got bug reports that 2c9d6c2b871d ("usbnet: run unbind() before > > > > unregister_netdev()") > > > > is causing regressions. > > > > I would like to see this reverted as well. For obvious reasons, > > the order in usbnet_disconnect() should be the inverse of > > usbnet_probe(). Since 2c9d6c2b871d, that's no longer the case. > > > > > > > > Rather than simply reverting it, > > > > it seems to me that the call needs to be split. One in the old place > > > > and one in the place you moved it to. > > > > I disagree. The commit message claims that the change is necessary > > because phy_disconnect() fails if called with phydev->attached_dev == NULL. > > The only place i see which sets phydev->attached_dev is > phy_attach_direct(). So if phydev->attached_dev is NULL, the PHY has > not been attached, and hence there is no need to call > phy_disconnect(). phydev->attached_dev is not NULL. It was linked to unregistered/freed netdev. This is why my patch changing the order to call phy_disconnect() first and then unregister_netdev(). Regards, Oleksij -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |