From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mta0.migadu.com (out-218.mta0.migadu.com [91.218.175.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 45F3B2C032E for ; Tue, 25 Aug 2026 03:34:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.218 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787628872; cv=none; b=RDSmapchi6B7e4MTRqfsRhpnRwzXDG25sgvikhcxnlAUmLTHoLQDIQHCfAhqLQT4rXz1FBx0cWzRZKU/zFMcyJWL+5BgbezZ0FeZOpiV9SD9X/Ane1fYtEekPWQoh9JxIXgBmb1gFz4IYycq4PyL6X9/T27YbbAgHQqN/3oih1Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787628872; c=relaxed/simple; bh=eSABOAXqj4oWn6u8Az5xzjeD/NF4DiV3b5/D4qwM62U=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Va3XtpwrbQyv5ikGJh863/E4u3H9LPCbHtVgglDxjh74XBQzTZEBkJHcnnbuLFpTn6MFHBwJA6ZdzzOyKD8yLkRom3eUvae4vObkH6CeJf86kluKoiRZS6pZyN5Dreej9bS50MLLdKiYfd6HEANhEeChl/1dD4eIy2+zwXBE3U0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=TznODQW5; arc=none smtp.client-ip=91.218.175.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="TznODQW5" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=eSABOAXqj4oWn6u8Az5xzjeD/NF4DiV3b5/D4qwM62U=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1787628867; v=1; x=1788233667; b=TznODQW5kHJmpGMrdKjpKZB3hrjprTO3g7xnMRNfdBuPXjX99A5zbMTu+OUmy41hlN5sFqen HKa3QLfGg05/VlJkfIvTcQU3XAuEGqh2FVcImsX9z5feuGkWxP2668wzq4XtnWNOGRaun4LZ9mk CN8kN9ZiKw1lm8wNev36VO0k= X-Envelope-To: linux-kernel@vger.kernel.org Received: from [198.18.0.1] (116.128.244.171) by smtp.migadu.com with ESMTPS id 6881395ec596a024; Tue, 25 Aug 2026 03:34:17 +0000 X-Mizu-Trace-ID: 6881395ec596a024 X-Migadu-Flow: FLOW_OUT Message-ID: <749d7a16-df31-4bcc-822b-3153fc69d072@linux.dev> Date: Tue, 25 Aug 2026 11:34:04 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net v1] net: phy: fix NULL deref in IRQ handler after unbind To: Andrew Lunn Cc: netdev@vger.kernel.org, hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, Xuanqiang Luo , stable@vger.kernel.org References: <20260824120703.107412-1-xuanqiang.luo@linux.dev> From: Xuanqiang Luo In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi Andrew, 在 2026/8/24 20:54, Andrew Lunn 写道: >> The IRQ is requested at attach time and released by phy_disconnect(), >> so phy_remove() cannot free it without a later double-free. > So this sounds wrong. > > If you unbind the PHY, you need to also unbind the MAC, since a MAC > without a PHY is useless. When the MAC unloads, it will call > phy_remove() so everything unwinds in the correct order. > > Andrew > > --- > pw-bot: cr > I agree that the MAC should normally be unbound before the PHY. Also, the paragraph about freeing the IRQ in phy_remove() was misleading. It was not relevant to the change being proposed, so I will drop it in v2. Do you mean that unbinding the PHY first through sysfs is not a supported operation? The same sequence was used to reproduce the issue fixed by commit c2b727df7caa ("net: phy: Avoid NPD upon phy_detach() when driver is unbound"), which made me think that it should at least not crash: https://lore.kernel.org/all/20200917034310.2360488-2-f.fainelli@gmail.com/ If this ordering is required, would the right fix be to enforce it instead? Thanks, Xuanqiang