Article View: linux.kernel.netdev
Article #9612Re: [PATCH net 1/2] devlink: param: do not dereference a missing param item
From: Simon Horman
Date: Mon, 02 Nov 2026 12:02
Date: Mon, 02 Nov 2026 12:02
22 lines
8727 bytes
8727 bytes
On Fri, Oct 30, 2026 at 11:33:31AM +0800, Linkui Xiao wrote:
> From: Linkui Xiao <xiaolinkui@kylinos.cn>
>
> devl_param_value_changed() looks the param item up by id and only warns
> when the lookup fails. devlink_param_notify() is called with the result
> regardless, and devlink_nl_param_fill() dereferences param_item->param
> in its very first statement, so a driver that passes a param_id which is
> not registered on this instance turns the warning into a NULL pointer
> dereference.
>
> Every other user of devlink_param_find_by_id() handles the NULL result:
> devlink_param_unregister() and devl_param_driverinit_value_set() return
> right after the same warning, devl_param_driverinit_value_get() returns
> -EINVAL. Do the same here so that a bogus param_id costs a warning
> instead of an oops.
>
> Fixes: ea601e170988 ("devlink: Add devlink notifications support for params")
> Signed-off-by: Linkui Xiao <xiaolinkui@kylinos.cn>
> Link: https://lore.kernel.org/all/20230126075838.1643665-5-jiri@resnulli.us/
Reviewed-by: Simon Horman <horms@kernel.org>
Technical Details
Message-ID:
<20261102120216.GB257209@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-354644-linux-kernel-netdev=dewy.ruReferences:
<20261030033332.3685172-1-xiaolinkui@126.com> <20261030033332.3685172-2-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-354644-linux-kernel-netdev=dewy.ru From: horms@kernel.org (Simon Horman) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 1/2] devlink: param: do not dereference a missing param item Date: Mon, 2 Nov 2026 12:02:16 +0000 Organization: Usenet Network Message-ID: <20261102120216.GB257209@horms.kernel.org> References: <20261030033332.3685172-1-xiaolinkui@126.com> <20261030033332.3685172-2-xiaolinkui@126.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="2917127"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:Doxj2DfDBhavI/Ud1VOMERTdMj4= sha256:AUBT7nCVw/FJugKaA8AsNquv+ZdzzskknRP+GRDBQfc= sha1:tWojIjypYrCU/oYx++rHKu/1WKw= sha256:LC2zOqKRbrayeXBo0Ult+1TF2agP1iYrfFx+HI0+kmk= 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 26DCF1124D1; Mon, 2 Nov 2026 15:14:04 +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 pX9NT4wLcnEi; Mon, 2 Nov 2026 15:14:00 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-354644-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 C36CB1124C7; Mon, 2 Nov 2026 15:13:50 +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 C5AB142927; Mon, 2 Nov 2026 12:03:16 +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=1793620950; b=5K2Dwy0CsuXW4pXOdxD8w8Cl5AA2ZSEvNd0au7LQCDv25DHWJ/ojU1NdjaFzDFDzv2rX C+1Wp1v2OTKcra8DxEKZi28rKylSIlfxCudlmqqiYx4tIF3xj2dV9vsJSYK860gD83uVX 2Sa/G3S2kdwY2HEijSWfnxLdzcgCqR2p/IMEa+DTK8vhFd2U4RCypOtPxZ9FIrq9mnDb8 TxTFW3WrOsMTI4Z1deSaCFtGV2rDRhml76+ZdQqRf4GzK3crzwlKi89dnG1leZBC0wkXn r1n0Kki/Wta3bVVjExgKC3FdvLUoiSH0tNjfqiy5FghnzN95uB1KnAP5vShvLwc1NfA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793620950; 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=hZXlQtMRwJoMC0setD1vs2sojkITG2Hqi73DKlZte5o=; b=NxbR8uwlka46czYly3QlTx6fS9DYcoqK9aYV6JR0m7TH1VEYTust/bgqMTLFiOa3Eh9K bGy2eA4SIPd2Ir5Fhga+/P3B+ktpeiIlJDr2xqaAFBd80gO4uGGSud4XzZsZi+fXfqSoN f3Vwb9ieUKXJzwI8PcT5JXCiz4yT4yOiRfLKiLT04nZj0i/Hwj6gLtIu4hwYVeaJC2bSQ FbMijJO5i0plzx9Xjv7oYD4j4PzTU8Okdk/s6rDX67kL7xnl66G+lDqaQGHBNX5PO8nUe 2XnyBQ1nbzoPvAPc+WJpDTd/+BJN+Ts0to8oo8j6MhzgcfdTBAdl1uorJkpRv+1ny/g== 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=iLTAQJ5+; 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 18641606A970; Mon, 2 Nov 2026 12:02:30 +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=iLTAQJ5+ 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=1793620941; b=duN01wt2HgPNfcHpa4FpWgYiOFG26RFoz5Sz9WO4HYrL3MwNTDgIRLDvl3rBhDmy20LW zmcGNtLe5dRDCH4YwKeDDU19XxNXrTh7YtlPXGZ1kIjFEbGC9qN9zZtZ3IdOvBdvibVkP HykLvyWmqAEn+s1C3zO1UwvLf3L1Kee6Ns8qqGrsi3tWp2icce59ZC+p2DdBqOsAw8iuO 6q0ur0VMGrW2bc142pjC/Joqc01cUlBIvO/wLM7MX9yUj/jJ394jw9NOLJ+jMAXsSsObO uhfmosDg07iiMyl3E2NV/Nq2ue5D8T79osA+3H3bx3ZbbN5Y7QQ5lLsExVUjOnBr9Uw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793620941; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=hZXlQtMRwJoMC0setD1vs2sojkITG2Hqi73DKlZte5o=; b=V3NhiIdGwgyfwVMppcFd9ZT613BtfsIBnFlOPKfNs18bR8O7Haz6nVa7OOL7mOkdulx6 gC+U/B3LmLJenFwNIqQ2t58JS1uMExX1I0J89ANxq6fzC67Ehkpc8rbG1gQU5HXPy/2US rv7GNRcPp4W0TiPzP+aE0axmqzl/j50rZLLueuMQvPKcowgPoYbkml55MzUYEooA8Bv6A y9LOg94AA52x1aqtB/PZUJdRm6CqBwKrXI5P1mgvuYQiliJt9H4yAzBGJDznZVhOuw9Uq 7s4XkyyHpVKsWGov9eGkqDUOLP1DDsjMpVlEXurOhYn6N4+4h8aYtcNpu3hWxl/0Eqg== 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=iLTAQJ5+; 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 EC02C606A32E; Mon, 2 Nov 2026 12:02:20 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id C97661F00A17; Mon, 2 Nov 2026 12:02:18 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793620940; bh=hZXlQtMRwJoMC0setD1vs2sojkITG2Hqi73DKlZte5o=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=iLTAQJ5+cbgBERicuwswMxfV34uUHNqP4YNFhMHyHkyXL7efA9aADqK18l3Ri8izG g2ht+swiELcSL9tt3KGOqLKEgBYVmO74XdmrKhSSK84Pc5Zj/DKzRh0TBv+c9xZ37p HAtLGZl4WRJ1kEcZDj4retfSUBs26eJRhyMUcPx6UcLGZ+bZ+4bNIqSnQI2YascR82 FyWClhjo16phQhJ0A895gEFhGY4V9HSD7wpvSt8Js8PlUoPtAkr5UXPgtvO48A2HIg uK1MJlWrg1FlbIWlvsDq2zSoNluku7FcBeUXYx6+E5D82yhCbkk26tIKlYBUFhv0uK SqE1Q2cEc+uBA== 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-2-xiaolinkui@126.com>