From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C9F82288CB; Thu, 7 May 2026 16:01:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778169689; cv=none; b=SDT6QvU5OiFSVfN9ZgDN6djt0APyFhrdZD45zMpcJB+Mr8nVJ3OBSRUFK1hi4vhZOK4YliqnKpy1YDUos/TlJK63nFS4OGTH/XTPcDFEwZm2ustmpxGs+B0ZjAUa3pjCuPcOWtG21LM3aXTgpSrTiQFCi5qhMsi+N3+DeMmaFd4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778169689; c=relaxed/simple; bh=Y87c8rgf5Me61NjHZqAJx7x2YdYTO9VlCNejGsYJBuo=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=IyQ/QaQbs0OczRzCGWEE3h5wY4mpJj9uHkDpbMbK4s0MgcZcLeDyQ5BlgN9nQKqokd+7LfNnHSr/Vr+NAoMMtHeV1C7nhiInKdHK49Vp1QVjwn0NEFAk+5W0aP2Plr777YyeVc5V9M8rky4vISSw58B6OuBe5ZB8swT8STQ+xss= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dP5MZYWP; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dP5MZYWP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A0BAC2BCB2; Thu, 7 May 2026 16:01:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778169689; bh=Y87c8rgf5Me61NjHZqAJx7x2YdYTO9VlCNejGsYJBuo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=dP5MZYWPxelGzt/aJZ3RU85/wmKuzBI+xpBxd4tBOsiT/zeWMkznnogWi9KB+mJty LvAOrrtQcJddfbE7QLFieq+dpdjDmnCM5iPjMmAgXG33gHuD6JrYqn8v7p2caiC4aU ZwtWhM6vhbXIq2ehcnAaijwzp2awdxgfp57ypTORcef4aD+hPBWpUXu4DH9+mLq6Lm UyPo94Xh9W52ouAQmUO8VhsbPJzpmyndPxI4TvRyj4xG1E+dqfNMZo/KLMcKIw2YNN CBXgkprrxeS8prvRgo2BHDhFk4OOiL3LQ+d2uVAaPKBOtieuVkxyFuC6D7fcCq/rRV YhD65Pyj47j/A== Date: Thu, 7 May 2026 09:01:27 -0700 From: Jakub Kicinski To: Bobby Eshleman Cc: Paolo Abeni , Alexander Duyck , kernel-team@meta.com, Andrew Lunn , "David S. Miller" , Eric Dumazet , Russell King , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bobby Eshleman Subject: Re: [PATCH net v2] eth: fbnic: fix double-free of PCS on phylink creation failure Message-ID: <20260507090127.285a5087@kernel.org> In-Reply-To: References: <20260504-fbnic-pcs-fix-v2-1-de45192821d9@meta.com> <6cec0c03-5bdc-4131-9899-bc5c77fba198@redhat.com> <20260507072453.5eec7051@kernel.org> <20260507072954.263ae8dd@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 7 May 2026 08:35:21 -0700 Bobby Eshleman wrote: > > > fbd is a devlink priv, not netdev priv, touching it after free_netdev() > > > is perfectly fine. I wish Gemini tried a *little* harder instead of > > > guessing :| Sorry for not commenting earlier. > > > > Ugh, not enough coffee. It's complaining about MDIO reads, I think > > that's valid. > > It is, but I think the race pre-exists. > > static int > fbnic_mdio_read_pmd(struct fbnic_dev *fbd, int addr, int regnum) > [...] > if (fbd->netdev) { > fbn = netdev_priv(fbd->netdev); > if (fbn->aui < FBNIC_AUI_UNKNOWN) > aui = fbn->aui; > } > > > Definitely possible that ->netdev gets freed concurrently with > fbd->netdev evaluating to true... but fbnic_netdev_free() faces the same > race. > > I'm open to fixing this all at once, if preferred. Probably need to look > at some of the other fbnic_net ptr guards too. I agree with Paolo, seems separate. FWIW I think the fix may be to move the single aui field that mdio cares about to fbd instead of fbn ? Feels like the problem is due to a layering violation, mdio should not be touching fbn fields.