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 2B5C8C5AD4C for ; Thu, 23 Nov 2023 13:35:43 +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:MIME-Version:References:In-Reply-To: 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=5Uzcdbb16i/Kn3ha9M/f6nOuk7OlaXkvElZoNP2WoIA=; b=LjwM+hVvSwJeGq 8Dm0CgDk4+juaMGQJ/RPQf9lpqJFeb2ZTw5tqxLLZ1WfIat1+a6BzSDVgqaN0Z/Eqf05mm6UtsqZi qVN2QcGfddLbrNN3YcO8GOgUDdYGjm8G+aSLo/2yj8uHQjrN4cxst336NF69hwEoVZ0X4DV6DxeBl Y+cPPNA2fVLm871CEaawahW+o9R/UVAKP/3ht15jJkXM1XJ/HU51rhGhEMNIhYcuUuQm8IXMLMRk2 rmwJ1We2he626su76DDKFR6133xKtTncreeZyFQsShzI7mF+3emwVqb9bsUXyi0uvvZM9NiNc1GUh EE8CQYSttUH/Dxi5oPPQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r69rM-004tkX-0o; Thu, 23 Nov 2023 13:35:12 +0000 Received: from relay5-d.mail.gandi.net ([2001:4b98:dc4:8::225]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r69rJ-004tin-0T for linux-arm-kernel@lists.infradead.org; Thu, 23 Nov 2023 13:35:10 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id DD7DD1C0007; Thu, 23 Nov 2023 13:35:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1700746505; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mI4znOI0zE5PCCzZTTeLMyK+ZXMtNz24QJhN8KXDmLA=; b=EtcX4T8VhqjpHCjMpiAz1lTycXWcOjenC90NFWYOwNIhxgMZCuHf2pxZbLcclEXAXOE63P 2hu19ZFS7LgZITw3sRvmmVQkCWWbuy/9qOUihaTgl1p28zlnSIiHRoHYd/IZ+kTOQEB/1s jWV9pfUI8PxVdlKHpKUXh7WyYu160a0hFynJxTEcxbETVLmPIB7x2foY8DaUjh6UB44ST8 hZjDRtQ/QaTMSacxb5rjNOlDvwncJKdnY4Qzs89ZlZ9yeYFikgaKK2vTxgDN3xGLD527tT Tevhxp97kPmtXnkFhTKio9ZFgG2aARv8x8AJzeIXQRToNSXG+FM9ZY0OAQOCbQ== Date: Thu, 23 Nov 2023 14:35:02 +0100 From: Maxime Chevallier To: "Russell King (Oracle)" Cc: Andrew Lunn , 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 , =?UTF-8?B?S8O2cnk=?= Maincent , Jesse Brandeburg Subject: Re: [RFC PATCH net-next v2 04/10] net: sfp: Add helper to return the SFP bus name Message-ID: <20231123143502.3a9a9047@device.home> In-Reply-To: References: <20231117162323.626979-1-maxime.chevallier@bootlin.com> <20231117162323.626979-5-maxime.chevallier@bootlin.com> <00d26b50-56f1-4eac-a37f-36cf321bd46a@lunn.ch> Organization: Bootlin X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-redhat-linux-gnu) MIME-Version: 1.0 X-GND-Sasl: maxime.chevallier@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231123_053509_329507_9EABF555 X-CRM114-Status: GOOD ( 13.80 ) 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 Hi Andrew, Russell, On Tue, 21 Nov 2023 10:20:43 +0000 "Russell King (Oracle)" wrote: > 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. > That's right, I'll add an assert and document it, thanks for spotting this. Maxime _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel