Paulo Alcantara
01f2ee7e32
cifs: fix memory leaks in session setup
...
We were only zeroing out the ntlmssp blob but forgot to free the
allocated buffer in the end of SMB2_sess_auth_rawntlmssp_negotiate()
and SMB2_sess_auth_rawntlmssp_authenticate() functions.
This fixes below kmemleak reports:
unreferenced object 0xffff88800ddcfc60 (size 96):
comm "mount.cifs", pid 758, jiffies 4294696066 (age 42.967s)
hex dump (first 32 bytes):
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 00 00 00 00 00 ................
backtrace:
[<00000000d0beeb29>] __kmalloc+0x39/0xa0
[<00000000e3834047>] build_ntlmssp_smb3_negotiate_blob+0x2c/0x110 [cifs]
[<00000000e85f5ab2>] SMB2_sess_auth_rawntlmssp_negotiate+0xd3/0x230 [cifs]
[<0000000080fdb897>] SMB2_sess_setup+0x16c/0x2a0 [cifs]
[<000000009af320a8>] cifs_setup_session+0x13b/0x370 [cifs]
[<00000000f15d5982>] cifs_get_smb_ses+0x643/0xb90 [cifs]
[<00000000fe15eb90>] mount_get_conns+0x63/0x3e0 [cifs]
[<00000000768aba03>] mount_get_dfs_conns+0x16/0xa0 [cifs]
[<00000000cf1cf146>] cifs_mount+0x1c2/0x9a0 [cifs]
[<000000000d66b51e>] cifs_smb3_do_mount+0x10e/0x710 [cifs]
[<0000000077a996c5>] smb3_get_tree+0xf4/0x200 [cifs]
[<0000000094dbd041>] vfs_get_tree+0x23/0xc0
[<000000003a8561de>] path_mount+0x2d3/0xb50
[<00000000ed5c86d6>] __x64_sys_mount+0x102/0x140
[<00000000142142f3>] do_syscall_64+0x3b/0x90
[<00000000e2b89731>] entry_SYSCALL_64_after_hwframe+0x63/0xcd
unreferenced object 0xffff88801437f000 (size 512):
comm "mount.cifs", pid 758, jiffies 4294696067 (age 42.970s)
hex dump (first 32 bytes):
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 00 00 00 00 00 ................
backtrace:
[<00000000d0beeb29>] __kmalloc+0x39/0xa0
[<00000000004f53d2>] build_ntlmssp_auth_blob+0x4f/0x340 [cifs]
[<000000005f333084>] SMB2_sess_auth_rawntlmssp_authenticate+0xd4/0x250 [cifs]
[<0000000080fdb897>] SMB2_sess_setup+0x16c/0x2a0 [cifs]
[<000000009af320a8>] cifs_setup_session+0x13b/0x370 [cifs]
[<00000000f15d5982>] cifs_get_smb_ses+0x643/0xb90 [cifs]
[<00000000fe15eb90>] mount_get_conns+0x63/0x3e0 [cifs]
[<00000000768aba03>] mount_get_dfs_conns+0x16/0xa0 [cifs]
[<00000000cf1cf146>] cifs_mount+0x1c2/0x9a0 [cifs]
[<000000000d66b51e>] cifs_smb3_do_mount+0x10e/0x710 [cifs]
[<0000000077a996c5>] smb3_get_tree+0xf4/0x200 [cifs]
[<0000000094dbd041>] vfs_get_tree+0x23/0xc0
[<000000003a8561de>] path_mount+0x2d3/0xb50
[<00000000ed5c86d6>] __x64_sys_mount+0x102/0x140
[<00000000142142f3>] do_syscall_64+0x3b/0x90
[<00000000e2b89731>] entry_SYSCALL_64_after_hwframe+0x63/0xcd
Fixes: a4e430c8c8ba ("cifs: replace kfree() with kfree_sensitive() for sensitive data")
Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Steve French <stfrench@microsoft.com>
2022-10-19 17:57:51 -05:00
..
2021-06-20 21:28:17 -05:00
2022-10-19 17:57:41 -05:00
2022-10-19 17:57:41 -05:00
2022-10-05 01:31:18 -05:00
2022-10-05 01:31:18 -05:00
2021-11-10 16:30:13 -06:00
2021-11-10 16:30:13 -06:00
2022-10-15 10:05:53 -05:00
2021-06-20 21:28:17 -05:00
2022-01-02 20:38:46 -06:00
2022-01-02 20:38:46 -06:00
2022-10-05 01:31:18 -05:00
2021-04-25 16:28:22 -05:00
2021-09-13 14:51:10 -05:00
2019-05-30 11:26:35 -07:00
2019-05-30 11:26:35 -07:00
2022-08-05 11:24:03 -05:00
2021-09-13 14:51:10 -05:00
2022-10-07 23:08:39 -05:00
2022-10-18 11:33:43 -05:00
2022-09-14 04:00:06 -05:00
2022-10-15 10:05:53 -05:00
2022-10-05 17:42:38 -05:00
2022-10-13 09:36:04 -05:00
2022-08-19 11:02:26 -05:00
2022-10-13 09:36:39 -05:00
2022-10-13 09:36:39 -05:00
2022-10-05 01:31:18 -05:00
2021-07-22 11:43:23 -05:00
2022-10-18 11:33:43 -05:00
2021-09-13 14:51:10 -05:00
2021-09-13 14:51:10 -05:00
2021-09-13 14:51:10 -05:00
2022-10-18 11:33:43 -05:00
2022-10-07 23:06:48 -05:00
2022-08-11 20:03:04 -05:00
2022-10-05 01:31:18 -05:00
2022-08-10 21:26:08 -05:00
2022-10-18 11:33:43 -05:00
2022-10-15 10:05:53 -05:00
2022-01-19 11:21:08 -06:00
2022-10-13 09:36:04 -05:00
2022-08-11 10:33:18 -05:00
2022-10-07 23:08:39 -05:00
2022-08-29 12:47:15 +01:00
2020-12-14 09:16:22 -06:00
2022-08-17 18:07:13 -05:00
2019-05-24 17:36:45 +02:00
2019-05-24 17:36:45 +02:00
2022-02-17 07:00:39 -06:00
2022-10-13 09:36:04 -05:00
2021-09-13 14:51:10 -05:00
2022-10-18 11:33:43 -05:00
2022-10-13 09:36:04 -05:00
2022-10-14 12:35:25 -05:00
2022-03-26 23:09:20 -05:00
2022-10-19 17:57:41 -05:00
2021-11-05 09:50:57 -05:00
2022-10-13 09:36:39 -05:00
2022-10-19 10:06:23 -05:00
2022-10-19 17:57:51 -05:00
2022-10-13 09:36:04 -05:00
2022-10-15 10:05:53 -05:00
2021-09-13 14:51:10 -05:00
2022-10-07 23:08:41 -05:00
2022-10-05 01:31:04 -05:00
2022-10-05 01:29:21 -05:00
2021-09-08 23:59:26 -05:00
2021-09-13 14:51:10 -05:00
2019-01-24 09:37:33 -06:00
2022-10-05 01:31:18 -05:00
2022-10-10 09:10:28 -07:00
2021-04-25 16:28:23 -05:00
2021-09-13 14:51:10 -05:00
2022-08-05 11:24:03 -05:00