]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
tools: ynl: make sure we always pass yarg to mnl_cb_run
authorJakub Kicinski <kuba@kernel.org>
Tue, 20 Feb 2024 16:11:11 +0000 (08:11 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 1 Mar 2024 12:35:09 +0000 (13:35 +0100)
commit91addaf5f02b47e82bfd01c4b5100742c5138580
treeada7c3d1566ddbd19e56c4f2e3d137eddd7f8967
parent18a3d49aee3173fa0152a044ce607e6e01632444
tools: ynl: make sure we always pass yarg to mnl_cb_run

[ Upstream commit e4fe082c38cd74a8fa384bc7542cf3edf1cb7318 ]

There is one common error handler in ynl - ynl_cb_error().
It expects priv to be a pointer to struct ynl_parse_arg AKA yarg.
To avoid potential crashes if we encounter a stray NLMSG_ERROR
always pass yarg as priv (or a struct which has it as the first
member).

ynl_cb_null() has a similar problem directly - it expects yarg
but priv passed by the caller is ys.

Found by code inspection.

Fixes: 86878f14d71a ("tools: ynl: user space helpers")
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Link: https://lore.kernel.org/r/20240220161112.2735195-2-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/net/ynl/lib/ynl.c