Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp277188rdf; Tue, 21 Nov 2023 02:23:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IHW4LDYd1XAlIEfWaddi9VnQ3IUQeGuJ2pQQRqglpdf5x/FUOJ5FiYS6JaNTbPQvAFTSgOw X-Received: by 2002:a17:902:fa8f:b0:1cc:644a:2129 with SMTP id lc15-20020a170902fa8f00b001cc644a2129mr2843557plb.32.1700562230885; Tue, 21 Nov 2023 02:23:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700562230; cv=none; d=google.com; s=arc-20160816; b=n/XQ4+afthM8Plf14Ah8IAp/spVVce2Fopo15TZhSgX2888OkKrWIh5dBhjDdpvj6A X86rvmwq4CGN3S27Je1ysvKzsdq3lolqrM8UGlhQFliTU1TA645o1WH0z5jjfVC+inS/ NTiKFU+TGwaGK/cCfnuJUWaS/OPer+uBCfI5g2xGiLSUFG08OjaayjVw3e9FjsMQ9sqo L5Szbe8Sf2RjGcy9UN+iOkgzIL4ynQOozu1DoViWne0ZarjRbNoNGE2N1PT8Pj99T0sW a7wyt6B7tNy9IlUDioAFoHk4Bho7rKoK0pNKjnQ7K9eFppMNcEsA2F3s0N3sbSJ1h9Hk e/aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=41TdEsYoLDRD7QCMpUE7oCzBIqXCIxjP5nyED47SHKI=; fh=wiqJmYmStTzNNrWZR0w8jex6/TT1doOsfWYszmek92s=; b=MWKPZMvE8T7VaA0URe0+Y6WaWwTDjHVoj4dLAJEYebdsadijS0Q3RS3FqCxGieRa1K 7v9X3KhJcmAensB9Iwc7zPwxLeIyhJXPmcyLhFhuhUvOyj754KfPTKhJhZ38+Bv9dMep eA905Gzl+zFV+kLWF7xq4YVDb4r9yTHk1sXssSfi3uaO7fauxn8ZYAYf72aAoiU5G8Dl yhPlP1azZ+bCLr8uINQoVXnGrSltfo5yz2E4zysaDykSOjPO0HJJcZsAD/8v9TeEiSA/ TnYL95O0j2Vdsli4Fthjjp6o7ECXSyp1QE8rROEI2o4HX8XiK16HJOCeigkGGUVcGcwH C8ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b="h8U/2HO/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id e19-20020a170902ed9300b001bbc138af04si7007753plj.158.2023.11.21.02.23.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 02:23:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b="h8U/2HO/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 27A0B8062DEC; Tue, 21 Nov 2023 02:22:53 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232841AbjKUKWm (ORCPT + 99 others); Tue, 21 Nov 2023 05:22:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230304AbjKUKW1 (ORCPT ); Tue, 21 Nov 2023 05:22:27 -0500 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A93B92D59; Tue, 21 Nov 2023 02:20:48 -0800 (PST) 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <00d26b50-56f1-4eac-a37f-36cf321bd46a@lunn.ch> Sender: Russell King (Oracle) X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 21 Nov 2023 02:22:53 -0800 (PST) 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!