mirror of
https://github.com/torvalds/linux.git
synced 2026-10-07 19:16:02 +02:00
smb: server: fix leak of ksmbd_ipc_login_request_ext() returned buffer
Free it unconditionally after ksmbd_alloc_user() calls.
kmemleak splat:
unreferenced object 0xffff888103b83540 (size 192):
comm "pool-0", pid 16970, jiffies 4377290937
hex dump (first 32 bytes):
00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace (crc 408ccc66):
__kvmalloc_node_noprof+0x730/0x920
handle_generic_event+0xec/0x1a0 [ksmbd]
genl_family_rcv_msg_doit+0xe0/0x130
genl_rcv_msg+0x181/0x290
netlink_rcv_skb+0x4f/0x100
genl_rcv+0x28/0x40
netlink_unicast+0x1e6/0x2c0
netlink_sendmsg+0x20a/0x450
____sys_sendmsg+0x2e8/0x310
___sys_sendmsg+0x78/0xc0
__sys_sendmsg+0x63/0xc0
do_syscall_64+0xa1/0x670
entry_SYSCALL_64_after_hwframe+0x76/0x7e
Fixes: a77e0e02af ("ksmbd: add support for supplementary groups")
Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
This commit is contained in:
parent
bfdf81c62f
commit
1c3ebf832d
|
|
@ -439,6 +439,7 @@ int ksmbd_krb5_authenticate(struct ksmbd_session *sess, char *in_blob,
|
|||
resp_ext = ksmbd_ipc_login_request_ext(resp->login_response.account);
|
||||
|
||||
user = ksmbd_alloc_user(&resp->login_response, resp_ext);
|
||||
kvfree(resp_ext);
|
||||
if (!user) {
|
||||
ksmbd_debug(AUTH, "login failure\n");
|
||||
retval = -ENOMEM;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ struct ksmbd_user *ksmbd_login_user(const char *account)
|
|||
resp_ext = ksmbd_ipc_login_request_ext(account);
|
||||
|
||||
user = ksmbd_alloc_user(resp, resp_ext);
|
||||
kvfree(resp_ext);
|
||||
out:
|
||||
kvfree(resp);
|
||||
return user;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user