Wei Yongjun
f6b8c6b554
Bluetooth: sco: Fix crash when using BT_SNDMTU/BT_RCVMTU option
...
This commit add the invalid check for connected socket, without it will
causes the following crash due to sco_pi(sk)->conn being NULL:
KASAN: null-ptr-deref in range [0x0000000000000050-0x0000000000000057]
CPU: 3 PID: 4284 Comm: test_sco Not tainted 5.10.0-rc3+ #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1 04/01/2014
RIP: 0010:sco_sock_getsockopt+0x45d/0x8e0
Code: 48 c1 ea 03 80 3c 02 00 0f 85 ca 03 00 00 49 8b 9d f8 04 00 00 48 b8 00
00 00 00 00 fc ff df 48 8d 7b 50 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84
c0 74 08 3c 03 0f 8e b5 03 00 00 8b 43 50 48 8b 0c
RSP: 0018:ffff88801bb17d88 EFLAGS: 00010206
RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffffffff83a4ecdf
RDX: 000000000000000a RSI: ffffc90002fce000 RDI: 0000000000000050
RBP: 1ffff11003762fb4 R08: 0000000000000001 R09: ffff88810e1008c0
R10: ffffffffbd695dcf R11: fffffbfff7ad2bb9 R12: 0000000000000000
R13: ffff888018ff1000 R14: dffffc0000000000 R15: 000000000000000d
FS: 00007fb4f76c1700(0000) GS:ffff88811af80000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00005555e3b7a938 CR3: 00000001117be001 CR4: 0000000000770ee0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
PKRU: 55555554
Call Trace:
? sco_skb_put_cmsg+0x80/0x80
? sco_skb_put_cmsg+0x80/0x80
__sys_getsockopt+0x12a/0x220
? __ia32_sys_setsockopt+0x150/0x150
? syscall_enter_from_user_mode+0x18/0x50
? rcu_read_lock_bh_held+0xb0/0xb0
__x64_sys_getsockopt+0xba/0x150
? syscall_enter_from_user_mode+0x1d/0x50
do_syscall_64+0x33/0x40
entry_SYSCALL_64_after_hwframe+0x44/0xa9
Fixes: 0fc1a726f897 ("Bluetooth: sco: new getsockopt options BT_SNDMTU/BT_RCVMTU")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Luiz Augusto Von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2020-12-07 17:00:15 +02:00
..
2020-11-02 12:25:52 -08:00
2020-09-28 00:51:39 -07:00
2020-10-30 11:48:17 -07:00
2020-10-31 12:26:30 -07:00
2020-10-02 19:11:11 -07:00
2020-12-07 17:00:15 +02:00
2020-09-30 08:34:08 -07:00
2020-10-15 12:33:24 -07:00
2020-11-04 18:05:56 -08:00
2020-09-05 15:57:05 -07:00
2020-11-03 22:30:32 +01:00
2020-10-12 15:29:27 +02:00
2020-11-07 15:52:21 -08:00
2020-10-30 11:59:54 -07:00
2020-11-07 10:40:56 -08:00
2020-08-23 17:36:59 -05:00
2020-11-05 14:04:49 -08:00
2020-11-02 17:50:53 -08:00
2020-10-02 19:11:11 -07:00
2020-10-02 19:11:11 -07:00
2020-11-07 10:40:56 -08:00
2020-11-06 17:33:38 -08:00
2020-10-03 16:51:07 -07:00
2020-08-02 01:02:12 -07:00
2020-10-02 19:11:11 -07:00
2020-10-30 11:43:42 -07:00
2020-10-30 11:34:09 -07:00
2020-11-07 10:40:56 -08:00
2020-11-07 10:40:56 -08:00
2020-11-03 12:55:53 -08:00
2020-11-06 17:33:38 -08:00
2020-10-02 19:11:11 -07:00
2020-11-06 17:33:38 -08:00
2020-10-30 11:46:11 -07:00
2020-10-09 20:22:32 -07:00
2020-08-23 17:36:59 -05:00
2020-10-30 11:57:56 -07:00
2020-11-06 17:33:38 -08:00
2020-09-19 16:40:48 -07:00
2020-08-23 17:36:59 -05:00
2020-10-02 19:11:11 -07:00
2020-10-06 06:01:35 -07:00
2020-10-28 09:14:49 -03:00
2020-08-23 17:36:59 -05:00
2020-10-15 13:28:00 +01:00
2020-11-07 10:41:15 -08:00
2020-11-06 17:33:38 -08:00
2020-11-07 10:41:15 -08:00
2020-10-22 09:44:27 -07:00
2020-09-23 17:46:31 -07:00
2020-11-02 17:50:43 -08:00
2020-10-15 12:43:21 -07:00
2020-10-15 18:42:13 -07:00
2020-10-29 17:43:20 -07:00
2020-10-30 10:06:56 +01:00
2020-08-23 17:36:59 -05:00
2020-10-12 16:16:50 -07:00
2020-11-07 10:41:15 -08:00
2020-10-03 00:02:13 -04:00
2020-10-29 19:27:45 +01:00
2020-10-29 19:27:45 +01:00
2020-10-05 18:40:01 -07:00