🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #5257

Re: [PATCH net] netdevsim: avoid NULL dereference after failed probe

#5257
From: Jakub Kicinski
Date: Tue, 20 Oct 2026 02:25
29 lines
9074 bytes
On Thu, 15 Oct 2026 10:01:33 +0200 Daniel Machon wrote:
> There might be another approach though. Did you explore nsim_driver.dev_groups?
> Adding nsim_bus_dev_new_port_attr/nsim_bus_dev_del_port_attr there might work,
> and the fix will be simpler. I cant claim to be an expert in this area, but it
> might be wort investigating.

I had a similar feeling, but looks like nsim_bus_dev_numvfs_store()
already checks drvdata :\ Let's stick to this approach, but please
fix the flow to look identical to the check in numvfs_store:

        device_lock(dev);                                                       
        ret = -ENOENT;                                                          
        if (dev_get_drvdata(dev))                                               
                ret = nsim_XXX(nsim_bus_dev, num_vfs);            
        device_unlock(dev);     

Please make sure to include the info requested by the bot in next
version, namely:

- How the issue was discovered, e.g. hit in production, hit during
  development, syzbot report, manual code inspection, LLM or static
  analysis tool scan.

 - Whether the issue was actually triggered, or is only theoretical
   (e.g. found by code inspection). If it was triggered please include
   the symptoms, like the stack trace or error messages.
-- 
pw-bot: cr
Technical Details
Message-ID: <20261019192505.5e7b1341@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-348985-linux-kernel-netdev=dewy.ru
References: <20261012135941.78329-1-stitch@zju.edu.cn> <20261015080133.lv4rnnyuontntlkb@DEN-DL-M70577.microsemi.net>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-348985-linux-kernel-netdev=dewy.ru
From: kuba@kernel.org (Jakub Kicinski)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] netdevsim: avoid NULL dereference after failed
 probe
Date: Mon, 19 Oct 2026 19:25:05 -0700
Organization: Usenet Network
Message-ID: <20261019192505.5e7b1341@kernel.org>
References: <20261012135941.78329-1-stitch@zju.edu.cn>
	<20261015080133.lv4rnnyuontntlkb@DEN-DL-M70577.microsemi.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="3766659"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:V3VkoW8/JwwGfkjI3J0vcp6s5S8= sha256:9sYHx2y612jypwTg3vtje9XOHyoTfDqF4JqmvIfqT4c=
	sha1:o28BbX7lRwvtiXtEoLrESiw03N0= sha256:bE6pzSwOtoKv9+GxcOyVzzlC/DA8WwXW6NsbRfAyl7M=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 0B449110BCA; Tue, 20 Oct 2026 05:25:36 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.729
X-Spam-Status: No, score=-3.729 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.329, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id yUXvCiKKu4pX;
	Tue, 20 Oct 2026 05:25:33 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-348985-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 2CC2A110B7D; Tue, 20 Oct 2026 05:25:24 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id DBD873F7B9; Tue, 20 Oct 2026 02:25:17 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1792463117;
	b=h3RGJ67XiKLGVjwVNZHH9l8KOMaFWh0UaBY97a9UxbBGDfqHbINRnEz8pkDYAMGEipKK
	 KWeKy18xMdEwFjUV8qjt2ugFFfGf8Scp/xPPEJXhTvOWOsbMWvUx4mahx8hDHIGn35Z0N
	 GqHHhxbtqoMBPYARGSuOnM89XB5CPUCn8MqUhqKdsUaGJM1sdnHhJvKbQNmRFIB/zkB+5
	 BLsjxxy24BZTx+2qA8r+gPYgrJheCS3idSjTrR9jX0FuV7JnLS6eY/rw+LRPIr3je91kq
	 kwefex1PqTJ0KM8MBFj5IkC8LKM9qZsbuWE06XQ+/FMpFbOO6Bm9QUJf9enKBf0qR5g==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792463117;
	h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc:
	 Subject:Message-ID:In-Reply-To:References:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:Content-Type:Content-Transfer-Encoding;
	bh=kYD02ZXBlrEEySdNfcMyQ0toSOLtwjrwU+Tdgho5Jkg=;
	b=UP+Tu/jKIo0SRs0vw8TOAskadKhJ6yQAJws/8wHEdgffNYWqoQl8QzkppVRvFtteRi9q
	 6UE0WDWNmN5yG3INjzz7s29WPbb5GRASQaGZ65rDOuRP+ZWd1dZbiRiYr3Pr4jozSycgY
	 J4yN8eLTqLXTv1RPA0YCl+D0VpSpkfiDwnyGG8Wl8ocoquPjhxzq3USZteYBDqRQr+Y6M
	 45keTg2R3RUkD+TJNFbOw00yOHWF3rq2+CE+mNOhReYyyuqtO0ojQcSLL2WdDei4hmu5U
	 bBCh4I9aBOAHOtPWstw2NYSfZTF0fOpbYc/xP9iy+/jcKdcpnUP3eRle0+CdZWMJJ+A==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SPfgy3rU;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id B21D9606A323;
	Tue, 20 Oct 2026 02:25:17 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SPfgy3rU
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792463106;
	b=b6LLTTYN2GJ0vxITXZL8kZ99PJKMyP6gR0St7mggx0o951yqLELorQwmPpBUOkHQkxg3
	 9gHU8m7DpE8oFYfkgs09cUiKdg2oE5MqYAQzzCkhDPnxHnXlj+KSvRE/HE5lZyYxnK1PT
	 ojAtMxo7oyCWHjqNWQaYDM0JEAZr3oY/7kVV548QLfEOyIWgB4TVUqXzOry9S8vdqGSGq
	 0OuML6xz+j5sM4+oDwy97OZBIoxjoFRM9IidQG4fHD61l5YlPehzHxTqM49VjzxgG2/qR
	 XEF+suY5cCN3cpm4CU+Ith8SAdAGZzz4Z9LQgbvBhKoHsnUkL8R9gTEW/eJQdNKpAVw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792463106;
	h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID:
	 In-Reply-To:References:MIME-Version:Content-Type:
	 Content-Transfer-Encoding;
	bh=kYD02ZXBlrEEySdNfcMyQ0toSOLtwjrwU+Tdgho5Jkg=;
	b=RIPl/kG2/5TV2ue6+cAvVo37ZQ6DxGclOASjp87C1HJwL8ENLvRtOvdVliXYl/KjZFY1
	 yFh7Es8HYMSBzicagO7BYX23afkOqwfMU/jXGOZ+5FXjFl+SSDFvoQnDv/9UGeb33Evyj
	 2yb7nt9VxV74G8Sf6LT7+9Txc5NlTo1qrQc6Fi5yiXh6NhU8asZQQrzjLe74y6p23K7cb
	 TJIy+GrDdhZ3927ue9qFlDv2VxEWfpwaDgHps0PNf176zjfp/45OkwVwqrNK1xDGzN94Q
	 RDIIWbQNq1yqSeC9ietphlsdZV+HMWxPw8k2sPQaBgSWpjjBll71DT2b/zbYT8FOMMg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SPfgy3rU;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9402F606A319;
	Tue, 20 Oct 2026 02:25:06 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3E721F000C4;
	Tue, 20 Oct 2026 02:25:05 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1792463106;
	bh=kYD02ZXBlrEEySdNfcMyQ0toSOLtwjrwU+Tdgho5Jkg=;
	h=Date:From:To:Cc:Subject:In-Reply-To:References;
	b=SPfgy3rUpMslapQQG1A++l4xkexw+M4TH++6ArexD8P5QxXwn/7eHCfkB2FyrZJrO
	 1Hfib7VStokWwiJYb7rH3KpBMILwfWoFOGjSVMQNEfh681e10ESLp+O3PnWzV0fu7T
	 sxJcybPCyqxZFhepvffia3Rt/rj1dmENSfwh3axtuKlw934tHC/jkI4MQOcmrOlJYy
	 bMII4r8Ddaiq9ntZs93CU8oe8Q3oVmztqswKlUESszqjmmKUvtIuT9Ewxpu2vR2NtX
	 SJHLyOczQ2Py5JTaJq5TRwKysg4bX72vvawXGnd6KPcej90Z7+B2lWWivriTkjfIj+
	 s+yFe8PVU+A+w==
X-Cc: Jiacheng Xu <stitch@zju.edu.cn>, <andrew+netdev@lunn.ch>,
 <davem@davemloft.net>, <edumazet@google.com>, <pabeni@redhat.com>,
 <jiri@resnulli.us>, <netdev@vger.kernel.org>,
 <linux-kernel@vger.kernel.org>, <stable@vger.kernel.org>
X-In-Reply-To: <20261015080133.lv4rnnyuontntlkb@DEN-DL-M70577.microsemi.net>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list