From nobody Mon Jun 8 08:27:58 2026 Received: from mail-oo1-f71.google.com (mail-oo1-f71.google.com [209.85.161.71]) (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 43F912DC79A for ; Sat, 30 May 2026 23:18:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.71 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780183094; cv=none; b=e8EtM4kO/gqJVT3fFJickPcxGiGAqxd1c9kL2jWeXLReAu8T1A3cNOu+ng5qIqs9IWF5l/jyBjHPQO70C5eEK7bv6Ak+l0ckFbONWy9wrF9Uoi92Uph0KD1qomPrWldGaDNYXl3wmO88E4wZ0oRJg4LnzTQIUaUKlx9xAIW5Y48= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780183094; c=relaxed/simple; bh=Khlodc1Q0rV2D0xgpCsYt8KUR/kN2QVpo1ocYMDmWBQ=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=pnhvMODNDDkt76vsr5xOrOS7M5jn3Zzk9+H37awuaun1w2+xnCbG0q+iudOGiUz1X0RPS35ICUtzkrRidJqp3mC/TPSOIPknU2me1lGO7ysWx9uozTE29V6wRhUfruH6Y5N02QcngbXgquhRTR8tPUm+L03krQkdJ+v3F5shtBQ= 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.161.71 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-oo1-f71.google.com with SMTP id 006d021491bc7-69d92a86e3bso9080534eaf.1 for ; Sat, 30 May 2026 16:18:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780183092; x=1780787892; 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=5tZe7+vcLyp+44+fCfZa+zP6zTEqoSq/9y2mKk+KPgM=; b=WV6DC/6ZcvLo9Uv9nnzNL5Gfyf5GLie7YkCFPAPobFNFQjoftlDMLQQhRkN71miuGI mDZa7K2KAqKpdJzitR4nt9bi4Vt+mLHkmRkkJk7RC/CetTlahfIlK62afrmk+kDmFRwu FLn5uXfkO6aat7pwDn0hVPpopS3Lfw/XTFu+Uv632fTWkgNEJKLAM9ysI2Ri+w0be5RG uVAzm4sejZUq4MUvdynlI8G9bRJXE90MaxPXli/tpBxKoS1y2XMvdhj/u5JUzpytg/x5 d0cLlzJ9l7fr4aNvgLsavweFYjvXFcrZiy+tfu2eCQ/v7reltpwZDF+vADTJQ5rt9jZj ejZg== X-Gm-Message-State: AOJu0YyoZ/GF5axk8KHT+YLKo6OPel6HPwUuNo5X2Nbp2DJtjyHPwewS TQdcNpRBRCwoWlck2RAwDB1i6ACCYbr1mXVU35/aPk1yRPxXlS347bFhJLb+/j7pnYEcG/NlSmq 3Y9CMxzzDwPVNhvhl5GVpt3+zbtZMaKlwedWY2rwBZO9B2xbh687uvYKxUIc= 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:1791:b0:69e:25f:3b3b with SMTP id 006d021491bc7-69e102b59bbmr2635023eaf.17.1780183092162; Sat, 30 May 2026 16:18:12 -0700 (PDT) Date: Sat, 30 May 2026 16:18:12 -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: <6a1b7034.323e8352.141b09.0004.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