Namjae Jeon
a54c509c32
ksmbd: fix use-after-free bug in smb2_tree_disconect
commit cf6531d98190fa2cf92a6d8bbc8af0a4740a223c upstream.
smb2_tree_disconnect() freed the struct ksmbd_tree_connect,
but it left the dangling pointer. It can be accessed
again under compound requests.
This bug can lead an oops looking something link:
[ 1685.468014 ] BUG: KASAN: use-after-free in ksmbd_tree_conn_disconnect+0x131/0x160 [ksmbd]
[ 1685.468068 ] Read of size 4 at addr ffff888102172180 by task kworker/1:2/4807
...
[ 1685.468130 ] Call Trace:
[ 1685.468132 ] <TASK>
[ 1685.468135 ] dump_stack_lvl+0x49/0x5f
[ 1685.468141 ] print_report.cold+0x5e/0x5cf
[ 1685.468145 ] ? ksmbd_tree_conn_disconnect+0x131/0x160 [ksmbd]
[ 1685.468157 ] kasan_report+0xaa/0x120
[ 1685.468194 ] ? ksmbd_tree_conn_disconnect+0x131/0x160 [ksmbd]
[ 1685.468206 ] __asan_report_load4_noabort+0x14/0x20
[ 1685.468210 ] ksmbd_tree_conn_disconnect+0x131/0x160 [ksmbd]
[ 1685.468222 ] smb2_tree_disconnect+0x175/0x250 [ksmbd]
[ 1685.468235 ] handle_ksmbd_work+0x30e/0x1020 [ksmbd]
[ 1685.468247 ] process_one_work+0x778/0x11c0
[ 1685.468251 ] ? _raw_spin_lock_irq+0x8e/0xe0
[ 1685.468289 ] worker_thread+0x544/0x1180
[ 1685.468293 ] ? __cpuidle_text_end+0x4/0x4
[ 1685.468297 ] kthread+0x282/0x320
[ 1685.468301 ] ? process_one_work+0x11c0/0x11c0
[ 1685.468305 ] ? kthread_complete_and_exit+0x30/0x30
[ 1685.468309 ] ret_from_fork+0x1f/0x30
Fixes: e2f34481b2 ("cifsd: add server-side procedures for SMB3")
Cc: stable@vger.kernel.org
Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-17816
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-08-17 14:22:56 +02:00
..
2021-10-20 00:07:10 -05:00
2021-10-20 00:07:10 -05:00
2022-06-09 10:23:27 +02:00
2022-01-27 11:02:53 +01:00
2021-09-29 16:17:34 -05:00
2021-09-29 16:17:34 -05:00
2021-10-07 10:18:34 -05:00
2021-11-18 19:16:07 +01:00
2022-01-27 11:02:53 +01:00
2021-06-30 14:47:24 +09:00
2021-07-09 08:23:16 +09:00
2021-09-30 20:00:05 -05:00
2021-09-24 21:25:23 -05:00
2021-12-29 12:28:57 +01:00
2021-07-02 16:27:10 +09:00
2021-09-30 09:58:07 -05:00
2021-06-30 14:43:51 +09:00
2021-11-18 19:16:07 +01:00
2021-06-30 14:44:01 +09:00
2022-08-17 14:22:56 +02:00
2022-01-27 11:02:53 +01:00
2022-08-17 14:22:56 +02:00
2022-01-27 11:02:53 +01:00
2022-06-09 10:23:27 +02:00
2022-01-27 11:02:53 +01:00
2022-07-02 16:41:16 +02:00
2022-07-02 16:41:16 +02:00
2022-01-27 11:02:53 +01:00
2021-10-20 00:07:10 -05:00
2021-10-15 09:18:29 -05:00
2021-07-22 09:55:58 +09:00
2022-07-21 21:24:32 +02:00
2022-05-09 09:14:40 +02:00
2021-09-03 23:29:45 -05:00
2022-07-07 17:53:27 +02:00
2022-02-23 12:03:18 +01:00
2021-06-30 14:47:24 +09:00