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 004DA367F23; Wed, 29 Apr 2026 11:11:47 +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=1777461108; cv=none; b=tcIYxtSClnYDPH3s9J4INlxTjx4QTwffK4YbAwZ56RAZPzIqPiHilKFP9RM1cakZatFdatwz9xNhtMFz/Obmeo+OYAgBrqVW6HZg2hKNEg+Awq1WFJCRFQO/fFlz+AhykxKOFgxxXnE2C2G1Oi40Pp7k4XYE8XiRtBeqxvxv4V8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777461108; c=relaxed/simple; bh=syOXPPeZen3ifAWWngoKt0dD5VvYsSa/znr9tGMdl/4=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:Cc:To:From: References:In-Reply-To; b=ToUXYpEG3JFf8nLwXZyUZRlZHkwDCqJc+sgyNrw2D4VSNA5E2CznlS1C0KAOHlfkwklNRbSZquJqHzwGElHC6g8CywimHYAmzsyRYLvcEowSlOYp5HIRetBy9gtyJd4HPIDYMhX9DFakCAzrRSg5sopBVjobXJOeNMf5PoLoC78= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cUsXX4pp; 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="cUsXX4pp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2938EC2BCC4; Wed, 29 Apr 2026 11:11:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777461107; bh=syOXPPeZen3ifAWWngoKt0dD5VvYsSa/znr9tGMdl/4=; h=Date:Subject:Cc:To:From:References:In-Reply-To:From; b=cUsXX4ppZ6leE+BuPDsK9XgvhkMk4fef9UCEaBKFQzGu9cSuaYGty7av6Loxms6uw EktHjTzrV3PT6DRJFemlNR8EVj1AC36muvng+lPEKx3HmZZxvP//6OpBuOLRuOc4nY obUTgsxLFXMtn1mrXOGmjrQWD1s6x+8cVH1nkVNGUAmxLMYkDstXACPEfTbbIYnTsE x5AHYiu6bI5ohpKh8WaoyMRVo4Ia/kV6ArCv1Oj18YrozFoPjpYWJZwiKTUZk31rjl CBVongUUEVQ/ce20B/WJY/gSWhhPCljQWAvvL8F95M6j7Iw52Rldn9+BOrE4NY+5Of L83bFZIouUaeA== Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 29 Apr 2026 13:11:44 +0200 Message-Id: Subject: Re: [PATCH] driver core: reject devices with unregistered buses Cc: "Greg Kroah-Hartman" , "Rafael J . Wysocki" , , , To: "Johan Hovold" From: "Danilo Krummrich" References: <20260427102852.2174-1-johan@kernel.org> In-Reply-To: On Wed Apr 29, 2026 at 12:11 PM CEST, Johan Hovold wrote: > On Tue, Apr 28, 2026 at 09:09:04PM +0200, Danilo Krummrich wrote: >> On Mon Apr 27, 2026 at 12:28 PM CEST, Johan Hovold wrote: >> > Trying to register a device on a bus which has not yet been registered >> > used to trigger a NULL-pointer dereference, but since the const bus >> > structure rework registration instead succeeds without the device bein= g >> > added to the bus. >> > >> > Reject devices with unregistered buses to catch any callers that get >> > the ordering wrong and to handle bus registration failures more >> > gracefully. >> > >> > Fixes: 5221b82d46f2 ("driver core: bus: bus_add/probe/remove_device() = cleanups") >> > Cc: stable@vger.kernel.org # 6.3 >>=20 >> Hm...this sounds like hardening and not like a "real" bug fix. Do you ha= ve a >> specific reason why you added Cc: stable? > > It's certainly a bug fix and this change in behaviour was clearly > unintended. > > Any caller getting the ordering wrong would now succeed in registering > devices, but no driver would ever be bound which is harder to detect > than the earlier crashes.=20 > > Whether any offenders have snuck in since 6.3 I don't know, but I still > think this warrants a backport. I see where you are coming from, and I agree that having an explicit error = print is an improvement over "the device just never got probed". However, this isn't an actual bug -- it just happens to make a "real" bug l= ess obvious to catch. That said, I don't see how this warrants a stable backport, i.e. it doesn't= even fall under the "this could be a problem" or "theoretical bug" category, whi= ch typically are not accepted either. As mentioned in the other thread, if this was relaxed, I'm happy to hear ab= out it.