]> git.baikalelectronics.ru Git - kernel.git/commitdiff
RDMA/rtrs-clt: Move free_permit from free_clt to rtrs_clt_close
authorMd Haris Iqbal <haris.iqbal@ionos.com>
Thu, 17 Feb 2022 03:09:29 +0000 (04:09 +0100)
committerJason Gunthorpe <jgg@nvidia.com>
Fri, 18 Feb 2022 15:59:33 +0000 (11:59 -0400)
Error path of rtrs_clt_open() calls free_clt(), where free_permit is
called.  This is wrong since error path of rtrs_clt_open() does not need
to call free_permit().

Also, moving free_permits() call to rtrs_clt_close(), makes it more
aligned with the call to alloc_permit() in rtrs_clt_open().

Fixes: af01783ea5ce ("RDMA/rtrs: client: main functionality")
Link: https://lore.kernel.org/r/20220217030929.323849-2-haris.iqbal@ionos.com
Signed-off-by: Md Haris Iqbal <haris.iqbal@ionos.com>
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/ulp/rtrs/rtrs-clt.c

index 6164b07a16442706dd5e16ffcaf31b6c82dec4ef..759b85f033315df4a608869072aeeba56bbae072 100644 (file)
@@ -2771,7 +2771,6 @@ err_put:
 
 static void free_clt(struct rtrs_clt_sess *clt)
 {
-       free_permits(clt);
        free_percpu(clt->pcpu_path);
 
        /*
@@ -2893,6 +2892,7 @@ void rtrs_clt_close(struct rtrs_clt_sess *clt)
                rtrs_clt_destroy_path_files(clt_path, NULL);
                kobject_put(&clt_path->kobj);
        }
+       free_permits(clt);
        free_clt(clt);
 }
 EXPORT_SYMBOL(rtrs_clt_close);