Re: [PATCH net] net: ethtool: Don't call .cleanup_data when prepare_data fails

From: Simon Horman
Date: Fri Apr 04 2025 - 06:36:37 EST


On Thu, Apr 03, 2025 at 03:24:46PM +0200, Maxime Chevallier wrote:
> 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 successfull .prepare_data() as per the documentation.

Nit, if you have to respin for some other reason: successful

>
> Rewrite the error-handling paths to make sure we don't cleanup
> un-prepared data.
>
> Fixes: 728480f12442 ("ethtool: default handlers for GET requests")
> Reviewed-by: Kory Maincent <kory.maincent@xxxxxxxxxxx>
> Signed-off-by: Maxime Chevallier <maxime.chevallier@xxxxxxxxxxx>

I agree this makes sense and addresses all instances
of this problem in this file.

Reviewed-by: Simon Horman <horms@xxxxxxxxxx>