From nobody Mon Jun 8 07:24:00 2026 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (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 245D435675A for ; Sun, 31 May 2026 18:13:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780251186; cv=none; b=Yh0depNW/ko+VT/eW6VoGwQVLAc4cDMan4x60jQ2XHtS+hhMU09nk8JT+XIo14Fx529Jj80Z5qW3Lkglgusp9wicXnQMuTsS6kCxghgRf9izM1gUSinW583xRHK5xmApxZ+jQOoxmAcmIA/oFPwLdY+oOlPqpJMhBospLjUnIJY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780251186; c=relaxed/simple; bh=41lcXDK3u0Fs7rJePyR/4+UxqWAqtTx1zyL031IDj7I=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=gSnqXQXWIitAEl196hfBQ10CRhCfLrzWeXD2WFFUkggLQjtLxhWeuEflj5WTXl+lr3RsRV+UtHAy9laJ67BwZlDNWTGe6ff+hicPS7l5HZF4IL9pXMblkphDv0krWO6SR1KsRg/ViseIbGBQm5iN1GCoACqQ03bs+x/AXCE2VVM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=qrhJQ5j+; arc=none smtp.client-ip=209.85.214.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qrhJQ5j+" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-2bea7176c72so77751475ad.0 for ; Sun, 31 May 2026 11:13:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780251184; x=1780855984; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=sqKS7J7jIzI3/kIylXsI0Us8WHcLqW9oZuoMrN6OAq0=; b=qrhJQ5j+9tPeBXQCZfQNKy1Fr0PUO05/WekRl9Ov55xxqlhYg/J9st9qfFFzL86KTm yIP+9qLbkjVY76UNuqB0ami7FXgP0Oa6jVu0+QCUsiJ3i+/TeP1yX62lADT9DWUTrZQN YPeKPEu6d3gWUsEr7T+jw/p7LrWgViTDaTbkFFs6ma3UBmnB2QpBb4rghQ012usr8NkZ mHJ2lFvwrzsP4nBAVNhaBDOp0jOr63OdAFSjU1GUjIqGT67cvl7mqaK7OkJkTr4WqWjN /q6x/8LJ7mzGSM0nWZVfh9dBWwxpMem1KKkB7stoZj55WXFGJPuXOTelWy4bgXYKi6zb WldA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780251184; x=1780855984; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=sqKS7J7jIzI3/kIylXsI0Us8WHcLqW9oZuoMrN6OAq0=; b=YREfvRg8QhBQ7wU9vYm0UQwLZ70KaW9Yt6lU5/4oAYauii3sG7zYdu/NxGq5m4r1ef 7p9LwzsDKkHr81LIjFlbspqCkoaorTrjCN0m6lYELdCQk0ICk/jz5NLckIrv3NrM0oqv a2dEcuqAFocTTk0q7Gj7bwHYtbCdeLiGemCVQpRasjwERupCH5xTcN7WaOc5cdlE22o1 sO5l9+KRxBxYcJt+Z7X3kT2W4AORSYjkivzJ5aW6+rMkcjgOqxziWgaR3eTm/TT91rvI FQH4JJNIqGmNjH6NaawE7SdmJkuGIMO9qbXXn5aH6oTUNLtHJWmcn7I+POaJCp9NJMGm jnkQ== X-Forwarded-Encrypted: i=1; AFNElJ+Lth+YAAyI17U4qZzOvo18Lb/iBPVPjhezELgv9/v56+7utRvkaZ3nbFpoIKKLEjIfQtQK9u36BSt2y7g=@vger.kernel.org X-Gm-Message-State: AOJu0YzYrPqBYahXOkXuEhHcvOqBd7ns0hLiFVzysQHqLvHt1CY7uryx rcPMH/6pzKw1PA3KevodXXJ2po/x3As9Z5dBarwN/X5xipKx+yMrTJn0 X-Gm-Gg: Acq92OF7lqxDKMLLOkUy2uaHs1q8kinvVmtNePYHjSMBIe6L/U01mVJ1vsK+JOnnE3I z37dNEnJylYWlyATy9/U36Y7b4rVfYEVrl9BKRQ6j3UdbHtVyDrPdEjr1aBS59dbDlLww3wgg4u zO3kSFHxfjnevCPRkU4e/dFeLf5IKlQQzmjxXPoG02yrxxnVO2Ix0VdmEbjR1v4ObWL7OuGHv2A bryU+khABmTd6wBztPJaDpyKdMWswqjJuvjiWxgCJUwTJFhYXuiT5shiTVIi3+vNS1XMD7yFZ0+ /fY6pG03XWmnnBMzdvqurbRpVHq3SWBlSljns8aTXvn5zaqtZ5+/lY9UvF7etdc6rjarhqNZy+U mDBT7PXJAv1dNZHZX/nT6r2OZnvcX3y3oA84qLh8OSG43CnMD0QMqSWHL+MxFLxZcI7t1p6T+C4 vPaDucNJJSy5v5DTBUaFaK0v7Pzv7af5lYPLX7J/rEcfj9otbbwWeNBNEqoJxRHLIeQop0KAIqz An406N5OlOeKZqIxzogvw4ojXIgAiwbsKrD23Zg X-Received: by 2002:a17:903:3d0b:b0:2c0:a9b3:bdc6 with SMTP id d9443c01a7336-2c0a9b3bf60mr62784395ad.30.1780251184248; Sun, 31 May 2026 11:13:04 -0700 (PDT) Received: from rustle-HP-Pavilion-Laptop-14-dv2xxx.. ([49.205.241.70]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2bf23915adcsm78099575ad.0.2026.05.31.11.13.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 May 2026 11:13:03 -0700 (PDT) From: Bharath Reddy To: marcel@holtmann.org, luiz.dentz@gmail.com Cc: linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, Bharath Reddy , syzbot+535ecc844591e50588a5@syzkaller.appspotmail.com Subject: [PATCH v3] Bluetooth: fix memory leak in error path of hci_alloc_dev() Date: Sun, 31 May 2026 23:42:41 +0530 Message-Id: <20260531181241.105655-1-kbreddy.rpbc@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Early failures in Bluetooth HCI UART configuration leak SRCU percpu memory. When device initialization fails before hci_register_dev() completes, the HCI_UNREGISTER flag is never set. As a result, when the device reference count reaches zero, bt_host_release() evaluates this flag as false and falls back to a direct kfree(hdev). Because hci_release_dev() is bypassed, the SRCU struct initialized early in hci_alloc_dev() is never cleaned up, resulting in a leak of percpu memory. Fix the leak by explicitly calling cleanup_srcu_struct() in the fallback (unregistered) branch of bt_host_release() before freeing the device. Reported-by: syzbot+535ecc844591e50588a5@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3D535ecc844591e50588a5 Tested-by: syzbot+535ecc844591e50588a5@syzkaller.appspotmail.com Fixes: 1d6123102e9f ("Bluetooth: hci_core: Fix use-after-free in vhci_flush= ()") Signed-off-by: Bharath Reddy --- net/bluetooth/hci_sysfs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index 041ce9adc378..8957ce7c21b7 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c @@ -83,10 +83,12 @@ static void bt_host_release(struct device *dev) { struct hci_dev *hdev =3D to_hci_dev(dev); =20 - if (hci_dev_test_flag(hdev, HCI_UNREGISTER)) + if (hci_dev_test_flag(hdev, HCI_UNREGISTER)) { hci_release_dev(hdev); - else + } else { + cleanup_srcu_struct(&hdev->srcu); kfree(hdev); + } module_put(THIS_MODULE); } =20 --=20 2.34.1