Re: [PATCH net V2] net: pds_core: Fix possible double free in error handling path

From: Breno Leitao
Date: Mon Mar 04 2024 - 15:27:52 EST


On Sun, Mar 03, 2024 at 04:49:54PM +0800, hyper wrote:
> When auxiliary_device_add() returns error and then calls
> auxiliary_device_uninit(), Callback function pdsc_auxbus_dev_release
> calls kfree(padev) to free memory. We shouldn't call kfree(padev)
> again in the error handling path.
>
> Fix this by cleaning up the redundant kfree() and putting
> the error handling back to where the errors happened.
>
> Fixes: 4569cce43bc6 ("pds_core: add auxiliary_bus devices")
> Signed-off-by: hyper <hyperlyzcs@xxxxxxxxx>

I liked this v2 better.

Reviewed-by: Breno Leitao <leitao@xxxxxxxxxx>