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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 82A1DC5ACB3 for ; Tue, 21 Nov 2023 10:21:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=C9PPUgOJBy01xsHSJmaWA67v6eJWdMNlHyb4uMCQqus=; b=Ol+aARFvKfXAEK /XBwY0PnWcBxJoPYWOqHEnzURI0UW7SjXcX/s5nbDVfCy9rIWhnJ7He2Q8rOiSblO12mxtkv0D/z7 ctZU5DlZ8ufH3nLV5VC7isNDsduqOlYW/rf2qISmYriQazuKL3oUIIRDBtn8g/wnGaN+pdW1Lv3ky DcuwXmHQbEt/opZtoLWFKv0zsezdDvwNnBN7H0oeg1VntJCYyngR2W9RLfanHrZkIHTVf7WLJ1M9d RKqRmGmLgO0ajP35Fa7fERjItBpvePKffXrgaYmk/ucBXLIbc+FxK0D3aRE6KHiUavcnZbH5IpVSs h07ofX3LZiBRwXSofoiw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5NsI-00GFI6-0l; Tue, 21 Nov 2023 10:20:58 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5NsE-00GFGx-1L for linux-arm-kernel@lists.infradead.org; Tue, 21 Nov 2023 10:20:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=41TdEsYoLDRD7QCMpUE7oCzBIqXCIxjP5nyED47SHKI=; b=h8U/2HO/cq9SLWGR6DgkDHPCVL HmgCspiG/gquu7NVNxruR7bu3SYFZtlqOYrxtKV3ki/IldV6S2T7GX4Cwru3bBg6OIGlxdtqb5pDE tK8Y/UHV5cJl+6i7Fli8SaT2KDL+Vb3c50zvkvz9WTwRSCmfmFSDgYJKUiPVpF8x4iKZFQmbdKbXI 75Gva1+x/YXAMW7gF6FKXAaoUAkSDZCLnoclbtQGxDS52bVlpWs6M2RSs5k5jm4E3elS/2aoFn9QQ zEpkFWJhpzyug7kuZAXj9/uUqOTawF/Cny2nHfL2ip63bDI+AKeJamxDxVbC9iPZ/N5mCQqsZ2eCO 1sN5fNvA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:48514) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1r5Ns2-0006ps-11; Tue, 21 Nov 2023 10:20:42 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1r5Ns3-00046L-IX; Tue, 21 Nov 2023 10:20:43 +0000 Date: Tue, 21 Nov 2023 10:20:43 +0000 From: "Russell King (Oracle)" To: Andrew Lunn Cc: Maxime Chevallier , davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Jakub Kicinski , Eric Dumazet , Paolo Abeni , linux-arm-kernel@lists.infradead.org, Christophe Leroy , Herve Codina , Florian Fainelli , Heiner Kallweit , Vladimir Oltean , =?iso-8859-1?Q?K=F6ry?= Maincent , Jesse Brandeburg Subject: Re: [RFC PATCH net-next v2 04/10] net: sfp: Add helper to return the SFP bus name Message-ID: References: <20231117162323.626979-1-maxime.chevallier@bootlin.com> <20231117162323.626979-5-maxime.chevallier@bootlin.com> <00d26b50-56f1-4eac-a37f-36cf321bd46a@lunn.ch> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <00d26b50-56f1-4eac-a37f-36cf321bd46a@lunn.ch> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231121_022054_455795_3BBE2B84 X-CRM114-Status: GOOD ( 10.93 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Nov 21, 2023 at 02:00:58AM +0100, Andrew Lunn wrote: > > +const char *sfp_get_name(struct sfp_bus *bus) > > +{ > > + if (bus->sfp_dev) > > + return dev_name(bus->sfp_dev); > > + > > + return NULL; > > +} > > Locking? Do you assume rtnl? Does this function need to take rtnl? Yes, rtnl needs to be held to safely access bus->sfp_dev, and that either needs to happen in this function, or be documented as being requried (and ASSERT_RTNL() added here.) The reason is that sfp_dev is the SFP socket device which can be unbound via sfp_unregister_socket(), which will set bus->sfp_dev to NULL. This could race with the above. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel