]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 Apr 2025 08:43:25 +0000 (10:43 +0200)
commitec9faff49a4ea27731de39cb887b7e590e93157b
treec3c63884b839207053b17c4377591cfe496a7f8a
parentf6b84d1cfb4f24769b86c3011b440be4511e49f0
net: ethtool: Don't call .cleanup_data when prepare_data fails

[ Upstream commit 4f038a6a02d20859a3479293cbf172b0f14cbdd6 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ethtool/netlink.c