On Thu, Jan 20, 2022 at 06:36:32PM +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. > > free clt->pcpu_path and clt explicitly when dev_set_name fails. > For other errors after that, let the release function take care of > freeing them. Also remove free_percpu(clt->pcpu_path) from free_clt() > > Fixes: 6a98d71daea1 ("RDMA/rtrs: client: main functionality") > Reported-by: Miaoqian Lin <linmq006@xxxxxxxxx> > Signed-off-by: Md Haris Iqbal <haris.iqbal@xxxxxxxxx> > Reviewed-by: Gioh Kim <gi-oh.kim@xxxxxxxxx> > Reviewed-by: Santosh Kumar Pradhan <santosh.pradhan@xxxxxxxxx> > Reviewed-by: Jack Wang <jinpu.wang@xxxxxxxxx> > --- > Changes since v1: > - Explicitly free clt->pcpu_path and clt when dev_set_name fails > - Remove free_percpu(clt->pcpu_path) from free_clt function > > --- > drivers/infiniband/ulp/rtrs/rtrs-clt.c | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > Thanks, Reviewed-by: Leon Romanovsky <leonro@xxxxxxxxxx>