From nobody Mon Jun 8 08:35:26 2026 Received: from mail-ot1-f72.google.com (mail-ot1-f72.google.com [209.85.210.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CFEAD2DC79A for ; Sat, 30 May 2026 23:20:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780183210; cv=none; b=k+lPmWuzmxix987XhHaPp+t9HPAx+Vd2JElkwhUkhSMxUqRFjHZItzITZFy2oq4bbzkfoCu3hC2Cu7jzljtq9yVydzg4j76JDAMV/L7T5U1fXpm0o0Dk6ykOZUe7HhYssqB7tfzV8nmuMjuPt+7qPGENtAqzUg8/NMScq8UseJQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780183210; c=relaxed/simple; bh=lvDeGuyZ4qBMbT2gMGmtDw3OcLmRiWa9zk8M3cjpEuE=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=or7v85IwedL0f3jz+4S+ucx5vVILEodlKOTYSrz1uhsH0fj5mRx4ZT+9a3yRpzKqIJRn216ehj9gqsWFuYOYhIlaZnR8fsJsvsm7od5si2bx3ODOZbRVWakm70bvnc5QuHGm/3yhzxMQD9loadIXCMlJLy3w7rISQubuSb4fwX4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.210.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-ot1-f72.google.com with SMTP id 46e09a7af769-7e6b73b3920so78414a34.0 for ; Sat, 30 May 2026 16:20:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780183208; x=1780788008; h=to:from:subject:message-id:in-reply-to:date:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=HnXeAu5JlYPMu5ySpAO9KW3c/XEXX6wEVMNc9asY/xA=; b=RdAEazDvO4jgh/h4EocZUP7u/MJAqUB3QclLPlDXXxHQMEagdLVKEILvflZVgAxJap QYraxc2o6E+oiPBKBTN4ur4fzjlik0CEUr1F9yLNQ2HB/QT7VSzg/+/9JfJCQkSX5aXA HSMBSS4sJ0ZtZeucvrU1gqS403/EXBk/8s8mNVON5WeWyC2WuOcyS4OOeJCyJkW70OVR 1mloNMXJcFdVNgFYmQsudlF9WwswwEWE8Bvy1NVsXD2YHT7y1MorDkufc207EEgj0ho2 78lN8wXV1sTfZ/GP5IZWkAprFnsPEhVEUuIW4GXa4HY80iNux7Nyovbx+6dAPH3aUel2 gnbg== X-Gm-Message-State: AOJu0Yx6wFLCruNdlF6Y79aln6u8bsILT/cBXOfGkySa8qDvwAF+29En JKZH50Cw6rtJ6A93mFIUMNOU0A6cl9m8sDiEgb0jg1woZdxs9HKKyGtYP15uUj2MeHGcmmLbJBv QZT8fwayu+/OrPcxy+qPps0PENlaGxdwooMecg3ffHg9NbzMocsB9k8oLYzE= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a05:6820:822:b0:69d:8de0:bf3 with SMTP id 006d021491bc7-69e10476a7bmr2382496eaf.9.1780183207981; Sat, 30 May 2026 16:20:07 -0700 (PDT) Date: Sat, 30 May 2026 16:20:07 -0700 In-Reply-To: <6a1b4f33.fbc46276.d3ed.045a.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <6a1b70a7.fbc46276.d3ed.0578.GAE@google.com> Subject: Forwarded: [PATCH] Bluetooth: hci_core: Fix SRCU leak when device is freed unregistered From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com. *** Subject: [PATCH] Bluetooth: hci_core: Fix SRCU leak when device is freed un= registered Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.gi= t master hci_alloc_dev_priv() initializes hdev->srcu with init_srcu_struct(), but the matching cleanup_srcu_struct() is only called from hci_unregister_dev(). A hci_dev that is allocated and then freed without ever being registered leaks the SRCU internals - the node array and the per-CPU sda - even though the hci_dev itself is freed correctly. This is reachable from the hci_uart line discipline. h5_open() (used by the HCI_UART_3WIRE protocol) sets HCI_UART_INIT_PENDING, so hci_uart_register_d= ev() returns early without calling hci_register_dev() and HCI_UART_REGISTERED is never set. Registration is deferred until the three-wire link is synced, wh= ich never happens over a bare pty. When the tty is closed, hci_uart_tty_close() finds HCI_UART_REGISTERED clear, skips hci_unregister_dev(), and calls hci_free_dev() -> hci_release_dev() -> kfree(hdev), orphaning the SRCU allocations. kmemleak reports only the SRCU sub-objects, not hdev, confirming that hdev = is freed while its embedded srcu is not torn down: init_srcu_struct_fields+0x2c0/0x350 kernel/rcu/srcutree.c:207 hci_alloc_dev_priv+0x37/0x680 net/bluetooth/hci_core.c:2453 hci_alloc_dev include/net/bluetooth/hci_core.h:1763 [inline] hci_uart_register_dev drivers/bluetooth/hci_ldisc.c:644 [inline] hci_uart_set_proto drivers/bluetooth/hci_ldisc.c:720 [inline] hci_uart_tty_ioctl+0x173/0x460 drivers/bluetooth/hci_ldisc.c:774 Pair the SRCU init with destruction by calling cleanup_srcu_struct() from hci_release_dev(), so it runs on the final put_device() regardless of wheth= er the device was ever registered. Keep synchronize_srcu() in hci_unregister_d= ev() to drain readers walking the device list before the device leaves it. Reported-by: syzbot+535ecc844591e50588a5@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3D535ecc844591e50588a5 Signed-off-by: Deepanshu Kartikey --- net/bluetooth/hci_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 28d7929dc593..2d516beedb59 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -2664,7 +2664,6 @@ void hci_unregister_dev(struct hci_dev *hdev) write_unlock(&hci_dev_list_lock); =20 synchronize_srcu(&hdev->srcu); - cleanup_srcu_struct(&hdev->srcu); =20 disable_work_sync(&hdev->rx_work); disable_work_sync(&hdev->cmd_work); @@ -2737,6 +2736,8 @@ void hci_release_dev(struct hci_dev *hdev) kfree_skb(hdev->sent_cmd); kfree_skb(hdev->req_skb); kfree_skb(hdev->recv_event); + + cleanup_srcu_struct(&hdev->srcu); kfree(hdev); } EXPORT_SYMBOL(hci_release_dev); --=20 2.43.0