]> git.itanic.dy.fi Git - linux-stable/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)
committerJakub Kicinski <kuba@kernel.org>
Thu, 22 Feb 2024 01:02:28 +0000 (17:02 -0800)
commite4fe082c38cd74a8fa384bc7542cf3edf1cb7318
treeb2b1de93fbe20152f9c068dfe20be1dfe7ed3aee
parent9990889be14288d4f1743e4768222d5032a79c27
tools: ynl: make sure we always pass yarg to mnl_cb_run

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>
tools/net/ynl/lib/ynl.c