]> git.ipfire.org Git - thirdparty/linux.git/commit
ethtool: tsinfo: don't pass ERR_PTR to genlmsg_cancel on prepare failure
authorJakub Kicinski <kuba@kernel.org>
Tue, 26 May 2026 15:35:30 +0000 (08:35 -0700)
committerJakub Kicinski <kuba@kernel.org>
Thu, 28 May 2026 00:42:08 +0000 (17:42 -0700)
commitc3fc9976f686f9a95baf87db9d387f218fd65394
tree711c0076de4a13997b51cb31227a305c6c1b5565
parent1de405699c62c3a9544bcdcfb9eff8a01cfc7582
ethtool: tsinfo: don't pass ERR_PTR to genlmsg_cancel on prepare failure

The goto err label leads to:

genlmsg_cancel(skb, ehdr);
return ret;

If ethnl_tsinfo_prepare_dump() failed, it has not started a genlmsg.
There's nothing to cancel, and passing an error pointer to
genlmsg_cancel() would cause a crash.

Fixes: b9e3f7dc9ed9 ("net: ethtool: tsinfo: Enhance tsinfo to support several hwtstamp by net topology")
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Reviewed-by: Kory Maincent <kory.maincent@bootlin.com>
Link: https://patch.msgid.link/20260526153533.2779187-8-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ethtool/tsinfo.c