Commit c46fa891 authored by Md Haris Iqbal's avatar Md Haris Iqbal Committed by Jason Gunthorpe

RDMA/rtrs-clt: Move free_permit from free_clt to rtrs_clt_close

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: 6a98d71d ("RDMA/rtrs: client: main functionality")
Link: https://lore.kernel.org/r/20220217030929.323849-2-haris.iqbal@ionos.comSigned-off-by: default avatarMd Haris Iqbal <haris.iqbal@ionos.com>
Reviewed-by: default avatarJack Wang <jinpu.wang@ionos.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent 8700af2c
...@@ -2771,7 +2771,6 @@ static struct rtrs_clt_sess *alloc_clt(const char *sessname, size_t paths_num, ...@@ -2771,7 +2771,6 @@ static struct rtrs_clt_sess *alloc_clt(const char *sessname, size_t paths_num,
static void free_clt(struct rtrs_clt_sess *clt) static void free_clt(struct rtrs_clt_sess *clt)
{ {
free_permits(clt);
free_percpu(clt->pcpu_path); free_percpu(clt->pcpu_path);
/* /*
...@@ -2893,6 +2892,7 @@ void rtrs_clt_close(struct rtrs_clt_sess *clt) ...@@ -2893,6 +2892,7 @@ void rtrs_clt_close(struct rtrs_clt_sess *clt)
rtrs_clt_destroy_path_files(clt_path, NULL); rtrs_clt_destroy_path_files(clt_path, NULL);
kobject_put(&clt_path->kobj); kobject_put(&clt_path->kobj);
} }
free_permits(clt);
free_clt(clt); free_clt(clt);
} }
EXPORT_SYMBOL(rtrs_clt_close); EXPORT_SYMBOL(rtrs_clt_close);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment