Re: [PATCH] RDMA/srp: Fix error handling in srp_add_port
From: Leon Romanovsky
Date: Thu Dec 19 2024 - 06:52:48 EST
On Tue, 17 Dec 2024 15:55:38 +0800, Ma Ke wrote:
> The reference count of the device incremented in device_initialize() is
> not decremented when device_add() fails. Add a put_device() call before
> returning from the function to decrement reference count for cleanup.
> Or it could cause memory leak.
>
> As comment of device_add() says, if device_add() succeeds, you should
> call device_del() when you want to get rid of it. If device_add() has
> not succeeded, use only put_device() to drop the reference count.
>
> [...]
Applied, thanks!
[1/1] RDMA/srp: Fix error handling in srp_add_port
https://git.kernel.org/rdma/rdma/c/a3cbf68c696111
Best regards,
--
Leon Romanovsky <leon@xxxxxxxxxx>