On Thu, Feb 17, 2022 at 04:09:28AM +0100, Md Haris Iqbal wrote: > Callback function rtrs_clt_dev_release() for put_device() calls kfree(clt) > to free memory. We shouldn't call kfree(clt) again, and we can't use the > clt after kfree too. > > Replace device_register with device_initialize and device_add so that > dev_set_name can be used appropriately. > > Move mutex_destroy to release function so it can be called in alloc_clt err > path. > > Fixes: eab098246625 ("RDMA/rtrs-clt: Refactor the failure cases in alloc_clt") > Reported-by: Miaoqian Lin <linmq006@xxxxxxxxx> > Signed-off-by: Md Haris Iqbal <haris.iqbal@xxxxxxxxx> > Reviewed-by: Jack Wang <jinpu.wang@xxxxxxxxx> > --- > v3>v4: > Add Fixes line > v2>v3 > Fix dev_set_name > v1>v2: > Free clt->pcpu_path > > drivers/infiniband/ulp/rtrs/rtrs-clt.c | 37 ++++++++++++++------------ > 1 file changed, 20 insertions(+), 17 deletions(-) Applied to for-rc, thanks Jason