* [PATCH] ksmbd: Fix resource leak in ksmbd_session_rpc_open()
@ 2022-11-16 12:22 Xiu Jianfeng
2022-11-22 3:23 ` Namjae Jeon
0 siblings, 1 reply; 2+ messages in thread
From: Xiu Jianfeng @ 2022-11-16 12:22 UTC (permalink / raw)
To: linkinjeon, sfrench, senozhatsky, tom, hyc.lee, lsahlber
Cc: linux-cifs, linux-kernel
When ksmbd_rpc_open() fails then it must call ksmbd_rpc_id_free() to
undo the result of ksmbd_ipc_id_alloc().
Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
---
fs/ksmbd/mgmt/user_session.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/fs/ksmbd/mgmt/user_session.c b/fs/ksmbd/mgmt/user_session.c
index 3fa2139a0b30..92b1603b5abe 100644
--- a/fs/ksmbd/mgmt/user_session.c
+++ b/fs/ksmbd/mgmt/user_session.c
@@ -108,15 +108,17 @@ int ksmbd_session_rpc_open(struct ksmbd_session *sess, char *rpc_name)
entry->method = method;
entry->id = ksmbd_ipc_id_alloc();
if (entry->id < 0)
- goto error;
+ goto free_entry;
resp = ksmbd_rpc_open(sess, entry->id);
if (!resp)
- goto error;
+ goto free_id;
kvfree(resp);
return entry->id;
-error:
+free_id:
+ ksmbd_rpc_id_free(entry->id);
+free_entry:
list_del(&entry->list);
kfree(entry);
return -EINVAL;
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ksmbd: Fix resource leak in ksmbd_session_rpc_open()
2022-11-16 12:22 [PATCH] ksmbd: Fix resource leak in ksmbd_session_rpc_open() Xiu Jianfeng
@ 2022-11-22 3:23 ` Namjae Jeon
0 siblings, 0 replies; 2+ messages in thread
From: Namjae Jeon @ 2022-11-22 3:23 UTC (permalink / raw)
To: Xiu Jianfeng
Cc: sfrench, senozhatsky, tom, hyc.lee, lsahlber, linux-cifs, linux-kernel
2022-11-16 21:22 GMT+09:00, Xiu Jianfeng <xiujianfeng@huawei.com>:
> When ksmbd_rpc_open() fails then it must call ksmbd_rpc_id_free() to
> undo the result of ksmbd_ipc_id_alloc().
>
> Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
> Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Thanks for your patch.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-22 3:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-16 12:22 [PATCH] ksmbd: Fix resource leak in ksmbd_session_rpc_open() Xiu Jianfeng
2022-11-22 3:23 ` Namjae Jeon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).