From: Hillf Danton <hdanton@sina.com>
To: syzbot <syzbot+31c2f641b850a348a734@syzkaller.appspotmail.com>
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [bluetooth?] KASAN: slab-use-after-free Read in l2cap_send_cmd
Date: Wed, 15 Jan 2025 13:28:49 +0800 [thread overview]
Message-ID: <20250115052851.1857-1-hdanton@sina.com> (raw)
In-Reply-To: <677b9c97.050a0220.a40f5.0003.GAE@google.com>
On Mon, 06 Jan 2025 01:04:23 -0800
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: ab75170520d4 Merge tag 'linux-watchdog-6.13-rc6' of git://..
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17fa36f8580000
#syz test
--- x/net/bluetooth/l2cap_core.c
+++ y/net/bluetooth/l2cap_core.c
@@ -1747,6 +1747,8 @@ static void l2cap_unregister_all_users(s
}
}
+static DEFINE_SPINLOCK(l2cap_conn_del_lock);
+
static void l2cap_conn_del(struct hci_conn *hcon, int err)
{
struct l2cap_conn *conn = hcon->l2cap_data;
@@ -1797,7 +1799,9 @@ static void l2cap_conn_del(struct hci_co
if (conn->info_state & L2CAP_INFO_FEAT_MASK_REQ_SENT)
cancel_delayed_work_sync(&conn->info_timer);
+ spin_lock(&l2cap_conn_del_lock);
hcon->l2cap_data = NULL;
+ spin_unlock(&l2cap_conn_del_lock);
conn->hchan = NULL;
l2cap_conn_put(conn);
}
@@ -1819,6 +1823,8 @@ EXPORT_SYMBOL(l2cap_conn_get);
void l2cap_conn_put(struct l2cap_conn *conn)
{
+ if (!conn)
+ return;
kref_put(&conn->ref, l2cap_conn_free);
}
EXPORT_SYMBOL(l2cap_conn_put);
@@ -7477,6 +7483,13 @@ void l2cap_recv_acldata(struct hci_conn
if (!conn)
goto drop;
+ spin_lock(&l2cap_conn_del_lock);
+ conn = hcon->l2cap_data;
+ if (conn)
+ l2cap_conn_get(conn);
+ spin_unlock(&l2cap_conn_del_lock);
+ if (!conn)
+ goto drop;
BT_DBG("conn %p len %u flags 0x%x", conn, skb->len, flags);
switch (flags) {
@@ -7503,6 +7516,7 @@ void l2cap_recv_acldata(struct hci_conn
if (len == skb->len) {
/* Complete frame received */
l2cap_recv_frame(conn, skb);
+ l2cap_conn_put(conn);
return;
}
@@ -7566,6 +7580,7 @@ void l2cap_recv_acldata(struct hci_conn
}
drop:
+ l2cap_conn_put(conn);
kfree_skb(skb);
}
--
next prev parent reply other threads:[~2025-01-15 5:29 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-26 9:32 syzbot
2025-01-06 9:04 ` syzbot
2025-01-14 10:54 ` Hillf Danton
2025-01-14 15:16 ` syzbot
2025-01-15 5:28 ` Hillf Danton [this message]
2025-01-15 5:53 ` syzbot
2025-01-15 8:12 ` Edward Adam Davis
2025-01-15 9:11 ` syzbot
2025-01-15 9:46 ` [PATCH] Bluetooth: hci_core: sync hci rx and cmd sync work Edward Adam Davis
2025-01-15 16:13 ` Luiz Augusto von Dentz
2025-01-16 10:42 ` Hillf Danton
2025-01-16 15:31 ` Luiz Augusto von Dentz
2025-01-16 22:44 ` Hillf Danton
2025-01-15 10:25 ` [syzbot] [bluetooth?] KASAN: slab-use-after-free Read in l2cap_send_cmd Hillf Danton
2025-01-15 11:29 ` syzbot
2025-01-14 14:09 ` syzbot
2025-01-16 16:55 ` [syzbot] Re: [PATCH v1] Bluetooth: L2CAP: Fix " syzbot
2025-01-17 15:59 ` [syzbot] Re: [PATCH v2] " syzbot
2025-01-17 17:16 ` [syzbot] Re: [PATCH v3] " syzbot
2025-01-17 20:48 ` [syzbot] Re: [PATCH v4] " syzbot
2025-01-21 18:08 ` syzbot
2025-01-22 17:04 ` syzbot
[not found] <CABBYNZJYDW+k+RMZiLGxK094UB8bMcXeqqqMzDv7zkStRPTyTA@mail.gmail.com>
2025-01-17 1:24 ` [syzbot] [bluetooth?] KASAN: " syzbot
[not found] <CABBYNZ++2=0bfK328cVaFY3_94DL0v8W7aSWW7YgrKP+L8Ax1g@mail.gmail.com>
2025-01-17 16:54 ` syzbot
[not found] <CABBYNZKyZKqM4pNxjqPEc1ot5fi50Oy_0VnujUXrJOe_ZeWNWA@mail.gmail.com>
2025-01-17 17:56 ` syzbot
[not found] <CABBYNZKWo_+EuoOWTYUyAFQ2RuA1F4s3hgdeSHuy2v9A5d9XCg@mail.gmail.com>
2025-01-17 21:15 ` syzbot
[not found] <CABBYNZKX0GKVwEEmf6XhnL-RJKqzLvt0izVC152Lzc8MjWWo7A@mail.gmail.com>
2025-01-22 3:17 ` syzbot
[not found] <CABBYNZKDjf2wZYCmumoifFJ_OnG2vjJBqjE+0yOf9c6iqWA8+w@mail.gmail.com>
2025-01-22 17:52 ` syzbot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250115052851.1857-1-hdanton@sina.com \
--to=hdanton@sina.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+31c2f641b850a348a734@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®