]> www.infradead.org Git - users/hch/misc.git/commit
net: ethtool: Don't call .cleanup_data when prepare_data fails
authorMaxime Chevallier <maxime.chevallier@bootlin.com>
Mon, 7 Apr 2025 13:05:10 +0000 (15:05 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 8 Apr 2025 13:34:15 +0000 (15:34 +0200)
commit4f038a6a02d20859a3479293cbf172b0f14cbdd6
tree959dc7b77133004a8721e709f341fa3d88441c75
parent369609fc6272c2f6ad666ba4fd913f3baf32908f
net: ethtool: Don't call .cleanup_data when prepare_data fails

There's a consistent pattern where the .cleanup_data() callback is
called when .prepare_data() fails, when it should really be called to
clean after a successful .prepare_data() as per the documentation.

Rewrite the error-handling paths to make sure we don't cleanup
un-prepared data.

Fixes: c781ff12a2f3 ("ethtool: Allow network drivers to dump arbitrary EEPROM data")
Reviewed-by: Kory Maincent <kory.maincent@bootlin.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Link: https://patch.msgid.link/20250407130511.75621-1-maxime.chevallier@bootlin.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/ethtool/netlink.c