Article View: linux.kernel.netdev
Article #9615Re: [PATCH net 0/2] devlink: do not dereference a missing param item or shared buffer
From: Simon Horman
Date: Mon, 02 Nov 2026 12:05
Date: Mon, 02 Nov 2026 12:05
39 lines
9521 bytes
9521 bytes
On Fri, Oct 30, 2026 at 11:33:30AM +0800, Linkui Xiao wrote: > 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. Thanks, both these fixes look good to me. But I do wonder if the hardening aspect, from an in-tree pov, makes them net-next rather than net material. I say that, because my understanding is that there is some pressure to only push critical bug fixes via net. This is because of the recent up-tick in bug fixes driven by AI-related activities.
Technical Details
Message-ID:
<20261102120504.GD257209@horms.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-354646-linux-kernel-netdev=dewy.ruReferences:
<20261030033332.3685172-1-xiaolinkui@126.com>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-354646-linux-kernel-netdev=dewy.ru From: horms@kernel.org (Simon Horman) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 0/2] devlink: do not dereference a missing param item or shared buffer Date: Mon, 2 Nov 2026 12:05:04 +0000 Organization: Usenet Network Message-ID: <20261102120504.GD257209@horms.kernel.org> References: <20261030033332.3685172-1-xiaolinkui@126.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="2918136"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:YgxoLsF2W5cjOYBMB96kWtcMAic= sha256:d5ZmCW41IIjKn5C/S7HCqmDzuDtzcTKhEryw5nYorFs= sha1:Ymt5EswX3K3judXWrJJAbIO8ke8= sha256:6JjhqleY2NV6DrKLeCZfoc26i0VA1TYAzOezADMtQh4= Content-Disposition: inline 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 4EF141124E9; Mon, 2 Nov 2026 15:19:54 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, 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 OpW1VyZoQkYa; Mon, 2 Nov 2026 15:19:51 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-354646-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 635341124E7; Mon, 2 Nov 2026 15:19:43 +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 0075B3886F; Mon, 2 Nov 2026 12:05:22 +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=1793621118; b=cecZAJrINc4S0RD/XXfq30iJRt9vxh0Q5ENj74snofWZ3UH+cJ3WXBfHTcBdH+CrnyrS t1PYa/aMvmnLnXezTk4IihflSKYxXbx+cXcPXLgUo0pAIPxPphDkSsZMe0O8zPeAAM3qR akuDfnkTNdDMjckY67g2Cm3ksA7OpyD8D7yaEzQx4pzDe7nKiU9mBKRh3VVe0NiQUDTXV GGxCYyY9u+NvhlcOujsw+23df8KY6sZFh3gIbHaLEBcUBUsSc6jFzFB1tw7RgrGgk7Sob AKgXPACWr1eoWnU6XTuHAg3+r7EBhYL6ojF64XwkTovxYfYcuwBdl9/Fsc1Smfy/66g== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793621118; h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc: Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=hbeE3DAarKR8X1vVzLm4gObAcCpbrHaGz2CUHydJifQ=; b=xtzilSR7Tg39MsMtn5+67IvXtWELXkHKqT38s9fYx/XU0TSwXAu3xhl67SP+ZBXScJma MkaP7357LwDI9wGLtXq99juOkMdAlNWzzsk9HK4tZf6MumDI7DAuibVe2RN0kjAKpgyod 8KExW8JJd3GerwfF7wlcHMsMyaoCGb+1ga4CkSpXK75MVG21YpDWrbe9FY6DDoTE06sx0 mys+Qtl2rtxn4Dzr96ZaO2o0/w/TtgDv8byO3ArV6d8USo6OG6kdCF9hgpqvdDKtls3aR Gwl/Rt4p5rSz6oU9hSpXOZuRbJCOFDjPVyRplXb/5jf7tBMc/ClDIvCO5ozI21cpxMw== 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="CI4tiV/m"; 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 B128B606A334; Mon, 2 Nov 2026 12:05:18 +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=CI4tiV/m 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=1793621109; b=UQ7zqurRyjBo2LsMPux8MJh/HFojYWtzRzkmTCyp8L3QcHryvWw2LkNU7QIAmg8H2OFX fEfOdHiJsAeNiT7W71+Rxqk+6oPWCxWHT7FdLKlHHx8U8KYGr/SSzIYPepaQnc/OVLW0A LpIcDk59cn0S2n23nXJ7AR+7U3Whab7u53yYvRujC7ZyLx68t/friiO73DfzyU1XLFvFv TffpiehmbnhiTT5GzQGHlLJFStNVQuJcUHjxDJOcwiPj63vgF1vG+a4PXNQm13G3btbXC 7wN05a35q1XJQ0dS4z2mSoWXgZe2Q+OUlmIUF3XMFJh3UvcoxZrD49a24w6hu5gtDxA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793621109; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=hbeE3DAarKR8X1vVzLm4gObAcCpbrHaGz2CUHydJifQ=; b=JJR7k7akZR0ooe6drIGJ2eb3KUpM2LL7yWMVOciWyM4hdN9epTKSAcw1c4Yw40y0UDJt wtrXA7WNQXb4aap77IisBt/7/VDs5CdR8OkTyHQ79su0T+salQSzZPo2FG1SMIWFV7U4w iOdfBfDH8en1D5uzGgN8ll90C4KlG2fxPL0dBR260D9m07OuVXAT4ufVALhN7sFi/Niaa SJngZU8nEMyz6Ojv9sLpiJJ5+IxISZNp7jqueV6FTm3YVmk8+8jTVXgmEbAoPvGkbUIsz ErQgwQI/4zTbqHQSvivrtTOjF3668XLTY73Tr9mnc/zNPoeVRI2gVoAFaPG3WgOaFlA== 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="CI4tiV/m"; 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 B97A0606A329; Mon, 2 Nov 2026 12:05:08 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED26E1F00A16; Mon, 2 Nov 2026 12:05:06 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793621108; bh=hbeE3DAarKR8X1vVzLm4gObAcCpbrHaGz2CUHydJifQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=CI4tiV/m/CL1DJSchDXuai0U/0ncux81CJqiXpACcL0MZCLGMTYrBYLMUljUzRRZ2 naaTp6eYmL4wJqKeSsmdlNKvLL+o3akIjJdyFY3HhCJ1w9TCY9DU3YzBW1IBKXwTzk gtRHibFYVdrZVVdpPdo5idhN4vls+Pq7fVnzQl6XmRtxrUCYwTrchc/H6sQ8mketwZ mPiGAm+lyr4JKfxRZm+T83/4RXagFUjX73oeMX+Cj79eYyw5nmQiLywoxuVv1Dh43T SO2HUs8iTBv9izk82juLaep2/50y4QV0zcJ6gjnrw//xkHNSOft8FlMirHAf/4GSuN qsTlsmmKLp3XQ== X-Cc: jiri@resnulli.us, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Linkui Xiao <xiaolinkui@kylinos.cn> 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-In-Reply-To: <20261030033332.3685172-1-xiaolinkui@126.com>