🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #9654

[PATCH net-next v2 0/2] devlink: do not dereference a missing param item or shared buffer

#9654
From: Linkui Xiao
Date: Mon, 02 Nov 2026 13:15
50 lines
10301 bytes
From: Linkui Xiao <xiaolinkui@kylinos.cn>

Two devlink helpers look an object up by id or index, warn when the
lookup fails, and then pass the NULL result to code that dereferences
it. A driver mistake (a param_id that was never registered, an sb_index
that was never registered or is unregistered twice) therefore costs an
oops instead of a warning.

  1/2 param: devl_param_value_changed() hands the missing param item to
      devlink_param_notify() -> devlink_nl_param_fill(), whose first
      statement dereferences param_item->param.

  2/2 sb: devl_sb_unregister() runs list_del() on the missing shared
      buffer; list is the first member of struct devlink_sb, so it
      reads and writes through address 0.

In both cases every other user of the same lookup already returns right
after the warning, so the fixes just align the remaining callers; there
is no change of behavior beyond avoiding the dereference. The param side
follows the example Jiri set for devlink_param_unregister():

Link: https://lore.kernel.org/all/20230126075838.1643665-5-jiri@resnulli.us/

Both Fixes: tags point at the commits that introduced the unguarded
WARN_ON pattern; the current devl_() functions are pure renames of those
originals. No in-tree caller triggers either path today (the audit is
part of a defensive hardening pass), so both are aimed at stopping
out-of-tree drivers from turning a driver bug into an oops.

v2:
  - retargeted from net to net-next, as Simon suggested: with no in-tree
    caller able to reach either path this is hardening rather than a
    critical fix. No code change.
  - collected Reviewed-by: Simon Horman on both patches.
  - the Fixes: tags are kept so that stable can pick the commits up
    once they are in mainline.

Link: https://lore.kernel.org/netdev/20261030033332.3685172-1-xiaolinkui@126.com/

Linkui Xiao (2):
  devlink: param: do not dereference a missing param item
  devlink: sb: do not dereference a missing shared buffer

 net/devlink/param.c | 3 ++-
 net/devlink/sb.c    | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

-- 
2.25.1
Technical Details
Message-ID: <20261102131505.611343-1-xiaolinkui@126.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-354692-linux-kernel-netdev=dewy.ru

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-354692-linux-kernel-netdev=dewy.ru
From: xiaolinkui@126.com (Linkui Xiao)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v2 0/2] devlink: do not dereference a missing param item or shared buffer
Date: Mon,  2 Nov 2026 21:15:03 +0800
Organization: Usenet Network
Message-ID: <20261102131505.611343-1-xiaolinkui@126.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2934506"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:KMaPb6ibilVKavrzGAg03THNIpg= sha256:wXPCJGoDRfb57/82KBJCSfRg73jVH94qWQ2wf6ERH9s=
	sha1:L/aVTpjlHtj8REL2T5AKT7i0aLg= sha256:UAL3kEyXuGhiZZagGXsSXpZPNv2NRa1Qa8cKo3/UG7E=
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 E79A8112517; Mon,  2 Nov 2026 16:48:53 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.048
X-Spam-Status: No, score=-3.048 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
	header.d=126.com
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 RJbHBoEpcENj;
	Mon,  2 Nov 2026 16:48:50 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-354692-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=126.com
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id CBC9A1124A1; Mon,  2 Nov 2026 16:48:41 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id ABA112B95F; Mon,  2 Nov 2026 13:16:31 +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=1793625390;
	b=lxi0Uv9h5j/DxGHFwcIoLqBSA0g/FUjqPcBFywloNBZBcomckXMV1+SGw/Xq5w+tSK3I
	 3VFeFq3kXyqIP3u+hZZcs6A8hyjruV/mk2vrG2Ykyzlasirpq1in9dAg9ZkicmaTX5oLo
	 vLExLca3uIdwxX3L1HzS533V5puFfMu536UU3lr3wlpYYLJc36DGC5utNbjuY8fWSoJH4
	 Yk8Fr9dbNzI7rwfnQjefnzoftxu3auYCJlyHnRBEDEusLpBAxYajb2lQNxDNEf4AlsCDd
	 PhdfvnH/s8/2eaD9jIawzl+3rYiAYXaIDW2zoDPr5yQhPzqmUBdfafvXOMqrTccdq5A==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793625390;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:From:To:
	 Cc:Subject:Date:Message-Id:X-Mailer:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:Content-Transfer-Encoding:X-CM-TRANSID:
	 X-Coremail-Antispam:X-CM-SenderInfo;
	bh=+RBEZku2BTxh2Tsuk9qsqTna+uYNy6fFCXJNUfJkCC0=;
	b=F50w71i4q91o91AGEHA/QuNDga9pzMBD1ttlwnkNABR/Pbj8F6a9PRwfGNI7X1JN5EPQ
	 Jqj9vwsDAC4CC8flRq1TVDXxpeEDXVxfv+bM3UKscKB0Ymy0hphOi9lLhAH4AzwcWpwwQ
	 6G8z8TvgpPa0Mv3SPRwazYWuU0cSZTB025o8gohuVaaVoWBmrnZ8o/sX6XWugnvaPat4o
	 9nNW/pREmp8a/g67C9KLj3qDVgMcFwcF/1LN3DkWLILLDMQalIcV8bj52ONI8XBfDgnNW
	 E7CvnvB50pRVfcoxReU+iMcsBqDnh3Gdy/uiGoynwsd98j7eOb+BzsOENYhCnj4kUBw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=PtwM7tcN;
	dmarc=pass header.from=126.com;
	spf=pass smtp.mailfrom=126.com;
	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 CC590606A32D;
	Mon,  2 Nov 2026 13:16:30 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key, unprotected) header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=PtwM7tcN
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=117.135.210.8
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793625390;
	b=ese1Wk+vur6gxlHw1sZGCJlTaf2qg5MEhzxtb1nv/gifJBrV3cKEH/9YHFgjzEkPzaZ9
	 Uck1zEJBLEVVDI3EtUvQCaewse0iQmkQn6QHZ1pWQa/3W6XuzNgT/rmeDg6/6Q0vUVJTv
	 Ulr6foUPOalIp1l4uU4fQZIwRgvjn91bNJOrVlb6IchvhWQYgoXH0Rokw1gzopzEEno1C
	 lfsBOAHd3+UGa7ZN10K8M4+O2SRCgrmZidXFaIXvGFInp7kzgKVYPEElqITjjJzasygyY
	 yLEly1De/QWCVed5LZuBAMud2pm2LL8Y7c2qyHbdEgVe7t3qYNVOHHDqcUG40FTkK3g==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793625390;
	h=DMARC-Filter:DKIM-Signature:Received:From:To:Cc:Subject:Date:
	 Message-Id:X-Mailer:MIME-Version:Content-Transfer-Encoding:
	 X-CM-TRANSID:X-Coremail-Antispam:X-CM-SenderInfo;
	bh=+RBEZku2BTxh2Tsuk9qsqTna+uYNy6fFCXJNUfJkCC0=;
	b=HYWLjgEBNfvW9LlwlfSEqGtggHVlOaIMNQ9X6OG+NA/j9SueZJU8QIoNwF3FZhP3DDOn
	 V3aeAVLfMd5ZClnUqXZ5SslPzntTHJl995BlzXxFTvkirzjRZHsSyvaGruiHPn98cEOyA
	 hdbmi+PDfxHKeIE8NYX+I3Ryq2TERftBooYvuyhaFiYFqfhaJ8cdk3yXF1rOZXnmDX0wT
	 0CN/RcKkAoE9EvEi3F/LMbyoJinrEzgimXLpvnhcfJrp4AjJv+E/SaHvoz0++p25T93p0
	 bmeD81QIjDym7aRpZoXnlwUy6MsjdLRUUI3IsnkxrwVVB0Kx74rEe6+shsiEFJWgrcg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=126.com;
	spf=pass smtp.mailfrom=126.com;
	dkim=pass header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=PtwM7tcN;
	arc=none smtp.remote-ip=117.135.210.8
X-Received: from m16.mail.126.com (m16.mail.126.com [117.135.210.8])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C2DC606A324;
	Mon,  2 Nov 2026 13:16:26 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8C2DC606A324
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=126.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=126.com
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com;
	s=s110527; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=+R
	BEZku2BTxh2Tsuk9qsqTna+uYNy6fFCXJNUfJkCC0=; b=PtwM7tcN9iMAa8ztLR
	riJbkErUthBGBAHlkaSUJIuWARtDTbaLXQVKHWbMaQ+U5Vr0EjpTRV/nHu/LQglq
	1oqklTavkU+XghOqhbdWCE8XXAhSAcbpGu+wCMMTFvOCQFkbeA1LsnIkRA/h8fcm
	V8b8EUeGtgHZgIqZmJFk2rAXY=
X-Received: from localhost.localdomain (unknown [])
	by gzga-smtp-mtada-g1-1 (Coremail) with SMTP id _____wD3dz_ajOhqBgW6CA--.35094S2;
	Mon, 02 Nov 2026 21:15:07 +0800 (CST)
X-Cc: netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Linkui Xiao <xiaolinkui@kylinos.cn>
X-Mailer: git-send-email 2.25.1
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
X-CM-TRANSID: _____wD3dz_ajOhqBgW6CA--.35094S2
X-Coremail-Antispam: 1Uf129KBjvJXoW7AF18Gr1fZFyUWFyxuFyUJrb_yoW8ury7pF
	W5WFn8Kr1DtrW0vr4kZF4xZFyY93W7G34aka4rtw1Fvan8C3s2qr4jqw4aqF1Yy393Kw1U
	tw13AFs5uFyDAaDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2
	9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07ULo7NUUUUU=
X-CM-SenderInfo: p0ld0z5lqn3xa6rslhhfrp/xtbBlRsuBWrojNtRpAAA3F