Paulo Alcantara
a8f68b1115
smb: client: fix OOB in cifsd when receiving compounded resps
...
Validate next header's offset in ->next_header() so that it isn't
smaller than MID_HEADER_SIZE(server) and then standard_receive3() or
->receive() ends up writing off the end of the buffer because
'pdu_length - MID_HEADER_SIZE(server)' wraps up to a huge length:
BUG: KASAN: slab-out-of-bounds in _copy_to_iter+0x4fc/0x840
Write of size 701 at addr ffff88800caf407f by task cifsd/1090
CPU: 0 PID: 1090 Comm: cifsd Not tainted 6.7.0-rc4 #5
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS
rel-1.16.2-3-gd478f380-rebuilt.opensuse.org 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0x4a/0x80
print_report+0xcf/0x650
? srso_alias_return_thunk+0x5/0xfbef5
? srso_alias_return_thunk+0x5/0xfbef5
? __phys_addr+0x46/0x90
kasan_report+0xd8/0x110
? _copy_to_iter+0x4fc/0x840
? _copy_to_iter+0x4fc/0x840
kasan_check_range+0x105/0x1b0
__asan_memcpy+0x3c/0x60
_copy_to_iter+0x4fc/0x840
? srso_alias_return_thunk+0x5/0xfbef5
? hlock_class+0x32/0xc0
? srso_alias_return_thunk+0x5/0xfbef5
? __pfx__copy_to_iter+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? lock_is_held_type+0x90/0x100
? srso_alias_return_thunk+0x5/0xfbef5
? __might_resched+0x278/0x360
? __pfx___might_resched+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
__skb_datagram_iter+0x2c2/0x460
? __pfx_simple_copy_to_iter+0x10/0x10
skb_copy_datagram_iter+0x6c/0x110
tcp_recvmsg_locked+0x9be/0xf40
? __pfx_tcp_recvmsg_locked+0x10/0x10
? mark_held_locks+0x5d/0x90
? srso_alias_return_thunk+0x5/0xfbef5
tcp_recvmsg+0xe2/0x310
? __pfx_tcp_recvmsg+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? srso_alias_return_thunk+0x5/0xfbef5
? lock_acquire+0x14a/0x3a0
? srso_alias_return_thunk+0x5/0xfbef5
inet_recvmsg+0xd0/0x370
? __pfx_inet_recvmsg+0x10/0x10
? __pfx_lock_release+0x10/0x10
? do_raw_spin_trylock+0xd1/0x120
sock_recvmsg+0x10d/0x150
cifs_readv_from_socket+0x25a/0x490 [cifs]
? __pfx_cifs_readv_from_socket+0x10/0x10 [cifs]
? srso_alias_return_thunk+0x5/0xfbef5
cifs_read_from_socket+0xb5/0x100 [cifs]
? __pfx_cifs_read_from_socket+0x10/0x10 [cifs]
? __pfx_lock_release+0x10/0x10
? do_raw_spin_trylock+0xd1/0x120
? _raw_spin_unlock+0x23/0x40
? srso_alias_return_thunk+0x5/0xfbef5
? __smb2_find_mid+0x126/0x230 [cifs]
cifs_demultiplex_thread+0xd39/0x1270 [cifs]
? __pfx_cifs_demultiplex_thread+0x10/0x10 [cifs]
? __pfx_lock_release+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? mark_held_locks+0x1a/0x90
? lockdep_hardirqs_on_prepare+0x136/0x210
? srso_alias_return_thunk+0x5/0xfbef5
? srso_alias_return_thunk+0x5/0xfbef5
? __kthread_parkme+0xce/0xf0
? __pfx_cifs_demultiplex_thread+0x10/0x10 [cifs]
kthread+0x18d/0x1d0
? kthread+0xdb/0x1d0
? __pfx_kthread+0x10/0x10
ret_from_fork+0x34/0x60
? __pfx_kthread+0x10/0x10
ret_from_fork_asm+0x1b/0x30
</TASK>
Fixes: 8ce79ec359ad ("cifs: update multiplex loop to handle compounded responses")
Cc: stable@vger.kernel.org
Reported-by: Robert Morris <rtm@csail.mit.edu>
Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2023-12-17 19:00:12 -06:00
..
2023-11-04 09:20:04 -10:00
2023-10-18 13:26:18 +02:00
2023-11-07 12:11:26 -08:00
2023-12-11 15:40:41 -08:00
2023-11-20 14:56:36 +01:00
2023-12-10 16:53:46 -05:00
2023-11-07 12:11:26 -08:00
2023-10-18 13:26:19 +02:00
2023-12-17 09:27:36 -08:00
2023-08-29 14:25:26 -07:00
2023-11-10 09:52:56 -08:00
2023-10-18 13:26:19 +02:00
2023-10-18 13:26:19 +02:00
2023-10-30 09:47:13 -10:00
2023-11-02 16:15:30 -10:00
2023-12-04 07:43:16 +01:00
2023-10-18 13:26:20 +02:00
2023-10-12 15:21:00 -05:00
2023-11-18 14:54:07 +01:00
2023-11-07 12:11:26 -08:00
2023-11-07 12:11:26 -08:00
2023-11-17 19:55:46 +08:00
2023-11-03 22:24:11 +09:00
2023-10-28 16:16:19 +02:00
2023-11-22 10:17:10 +01:00
2023-11-30 23:29:34 -05:00
2023-11-07 12:11:26 -08:00
2023-11-07 12:11:26 -08:00
2023-11-07 12:11:26 -08:00
2023-01-30 12:51:54 +00:00
2023-12-04 10:19:32 +01:00
2023-11-07 11:54:17 -08:00
2023-10-30 09:47:13 -10:00
2023-10-30 09:47:13 -10:00
2023-10-18 14:08:22 +02:00
2023-10-18 14:08:22 +02:00
2023-11-07 12:11:26 -08:00
2023-11-02 19:38:47 -10:00
2023-10-18 14:08:22 +02:00
2023-12-12 10:25:46 -05:00
2023-11-07 12:11:26 -08:00
2023-11-07 12:11:26 -08:00
2023-11-03 15:15:47 -10:00
2023-10-16 12:44:04 -04:00
2023-10-18 14:08:23 +02:00
2023-09-18 12:03:46 -07:00
2023-11-08 13:39:16 -08:00
2023-04-13 13:13:52 -07:00
2023-12-15 14:19:48 -08:00
2023-12-06 16:12:50 -08:00
2023-08-31 12:07:34 -05:00
2023-11-07 12:11:26 -08:00
2023-11-07 12:11:26 -08:00
2023-11-07 12:11:26 -08:00
2023-11-02 20:53:31 -10:00
2023-10-18 14:08:25 +02:00
2023-10-18 14:08:25 +02:00
2023-10-30 09:47:13 -10:00
2023-11-24 09:45:40 -08:00
2023-12-06 16:12:45 -08:00
2023-10-30 19:26:39 -10:00
2023-10-18 14:08:26 +02:00
2023-10-18 14:08:26 +02:00
2023-11-02 19:38:47 -10:00
2023-10-18 14:08:26 +02:00
2023-11-02 19:38:47 -10:00
2023-10-30 09:47:13 -10:00
2023-12-17 19:00:12 -06:00
2023-12-06 16:12:45 -08:00
2023-10-05 13:42:11 +02:00
2023-10-18 14:08:28 +02:00
2023-12-12 19:00:37 -05:00
2023-11-05 08:28:32 -10:00
2023-11-02 08:19:51 -10:00
2023-12-13 11:14:09 -05:00
2023-04-13 13:13:54 -07:00
2023-10-18 14:08:29 +02:00
2023-08-20 10:33:43 -07:00
2023-11-25 08:57:09 -08:00
2023-10-18 14:08:29 +02:00
2023-09-20 14:22:01 +02:00
2023-10-18 14:43:23 -07:00
2023-10-18 13:26:15 +02:00
2023-10-18 13:26:15 +02:00
2023-10-30 19:28:19 -10:00
2023-10-03 19:48:44 -07:00
2023-10-30 19:28:19 -10:00
2023-11-02 20:53:31 -10:00
2023-11-02 20:53:31 -10:00
2023-06-26 09:50:21 -07:00
2023-05-17 09:16:59 +02:00
2023-10-04 10:32:20 -07:00
2023-11-02 20:53:31 -10:00
2023-10-18 14:43:23 -07:00
2023-08-18 10:12:11 -07:00
2023-07-11 11:41:34 +02:00
2023-10-18 14:43:23 -07:00
2023-10-04 10:32:20 -07:00
2023-10-18 14:43:23 -07:00
2023-10-24 17:57:45 +02:00
2023-11-02 20:53:31 -10:00
2023-10-25 22:17:04 +02:00
2023-10-12 18:53:36 +03:00
2022-12-01 10:46:54 -05:00
2023-08-21 13:46:25 -07:00
2023-10-30 09:14:19 -10:00
2023-09-22 14:09:06 +02:00
2023-10-19 11:02:47 +02:00
2023-11-20 15:05:18 +01:00
2023-10-19 11:03:15 +02:00
2023-08-28 11:04:18 -07:00
2023-12-06 16:12:49 -08:00
2023-08-23 14:17:43 -07:00
2023-08-19 12:12:12 +02:00
2023-11-20 15:34:22 +01:00
2023-11-02 20:53:31 -10:00
2023-10-22 17:08:07 -04:00
2023-10-04 10:32:25 -07:00
2023-11-03 23:28:33 +01:00
2023-10-25 16:47:10 -07:00
2023-10-30 09:14:19 -10:00
2023-11-02 20:53:31 -10:00
2023-10-18 13:26:15 +02:00
2023-12-15 14:19:48 -08:00
2023-11-02 20:53:31 -10:00
2023-05-19 04:30:22 +02:00
2023-05-19 04:30:22 +02:00
2023-07-13 10:28:04 +02:00
2023-05-24 08:42:16 -06:00
2023-08-15 08:32:45 +02:00
2023-08-06 15:08:35 +02:00
2023-05-24 11:03:59 +02:00
2022-11-25 13:01:55 -05:00
2023-08-29 14:25:26 -07:00
2023-10-18 13:26:15 +02:00
2023-11-18 14:54:07 +01:00
2023-05-17 15:20:17 +02:00
2023-11-07 11:46:31 -08:00
2023-05-23 21:43:26 -07:00
2023-11-02 20:53:31 -10:00
2023-02-20 11:53:11 -08:00
2023-10-09 16:24:16 +02:00