Skip to contentSkip to conversation

test

PATCH New Pei Xiao 2 participants 2 messages Dec 5, 2024 Bluetooth

lore
Share & tools
lore

Pei Xiao

author
#0 lore raw

PATCH 1/1 test

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

---
 net/bluetooth/mgmt.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
net/bluetooth/mgmt.c +13 -3
index b31192d473d0..bbc86b7dce07 100644
@@ -5519,8 +5519,12 @@ static void mgmt_remove_adv_monitor_complete(struct hci_dev *hdev,
 {
     struct mgmt_rp_remove_adv_monitor rp;
     struct mgmt_pending_cmd *cmd = data;
-    struct mgmt_cp_remove_adv_monitor *cp = cmd->param;
+    struct mgmt_cp_remove_adv_monitor *cp;
+
+    if (cmd != pending_find(MGMT_OP_REMOVE_ADV_MONITOR, hdev))
+        return -ECANCELED;
 
+    cp = cmd->param;
     hci_dev_lock(hdev);
 
     rp.monitor_handle = cp->monitor_handle;
@@ -5540,8 +5544,14 @@ static void mgmt_remove_adv_monitor_complete(struct hci_dev *hdev,
 static int mgmt_remove_adv_monitor_sync(struct hci_dev *hdev, void *data)
 {
     struct mgmt_pending_cmd *cmd = data;
-    struct mgmt_cp_remove_adv_monitor *cp = cmd->param;
-    u16 handle = __le16_to_cpu(cp->monitor_handle);
+    struct mgmt_cp_remove_adv_monitor *cp;
+    u16 handle;
+
+    if (cmd != pending_find(MGMT_OP_REMOVE_ADV_MONITOR, hdev))
+        return -ECANCELED;
+
+    cp = cmd->param;
+    handle = __le16_to_cpu(cp->monitor_handle);
 
     if (!handle)
         return hci_remove_all_adv_monitor(hdev);
Signature · 1 line
2.34.1
syzbot
#1 lore raw

Re: [syzbot] [bluetooth?] KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync

syzbot tried to test the proposed patch but the build/boot failed:

Hello,

syzbot tried to test the proposed patch but the build/boot failed:

failed to apply patch:
checking file net/bluetooth/mgmt.c
patch: **** unexpected end of file in patch

Tested on:

commit:         feffde68 Merge tag 'for-6.13-rc1-tag' of git://git.ker..
git tree:       upstream
kernel config:  https://syzkaller.appspot.com/x/.config?x=3891b550f14aea0f
dashboard link: https://syzkaller.appspot.com/bug?extid=479aff51bb361ef5aa18

compiler:
patch: https://syzkaller.appspot.com/x/patch.diff?x=134ca8df980000