From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-vs2-f43.google.com (mail-vs2-f43.google.com [74.125.227.43]) (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 032434AEBFC for ; Tue, 15 Sep 2026 16:03:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789488226; cv=none; b=YLF1FVTYBHzpSU6btWMAeh4YzYTzEXNkcJG9gQKcrIt8Gn+fhATremWirdb7G5YBf1dNnRWkGb4cy58xEnClYaITQvoERTINC5kddboaF9DXQfzwPNrN7ocq+/w5HX3X7gQHyZxQN/+YH2/TWjG51G9hPbJZ1Q8foQI/ZaUrAuA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789488226; c=relaxed/simple; bh=akz6aUJrU9noL7BHsmdBLUbZm7ypb5K09r+URlU8H/U=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=LHejehyPTBjilqe0AWukFcuMFYRiY9hFc2vkZNtWlijLMg6Q+Pu0v0LI202mlf64LXPdD0+FFRPv61L6zJstHfnoAArIy0WgnORuUsbHunFhRnIaRX21WysrHPuisgE3tzwhtzv5HTRDR2qy1vi0u2GuvklQ9QBIYG1rB89ulvQ= 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=UKlTD2QQ; arc=none smtp.client-ip=74.125.227.43 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="UKlTD2QQ" Received: by mail-vs2-f43.google.com with SMTP id ada2fe7eead31-791a9878aa9so1300500137.0 for ; Tue, 15 Sep 2026 09:03:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789488223; x=1790093023; 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:content-type; bh=9GyNMK0fri713TgvmOq1tEC71eXmhUWip0yVYKcndwI=; b=UKlTD2QQWoHcDSAKORijE3T5SpP2FC8yLQKha3P6ZMeIkiesNHf2uohZzct0ioprHU wZRj9C/Bbp+824m3Vd7tvtrl9pKlfK7+HyN01c9TvgPYcB06pEjeshEPW/yYHVF+Syi9 SQ6zFZ/5pnJOvqiFNoSVfSap3U6ZnqkuId4eVvzNFspVDPfo37dG3cQCcBEeq2rJ9aKb 5wIu4y0f2qssdNG7sX/AnBcfemh4FvBcc7A2wUHJO6RYPzIQI1QlNACaSZ708Q8psEYC +rvZ+n4t5j7aaX8bF92ieZBWR3qTyyMecE2ESSWI5koc3aYumm8UjHpiQcI7xAk0siVk 3Vww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789488223; x=1790093023; 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:content-type; bh=9GyNMK0fri713TgvmOq1tEC71eXmhUWip0yVYKcndwI=; b=GKjshKoWUa0w6G4QGJnQXsz1qDb1foVYKt9zssjsVIKtDhQEECb8OXQliGx7mVFPPd yJWRhxq3fak/5QZ87izR+3a/MiiU/bmSmnFU+ugrPB/fFN6t+ozlqYz5TJz/Tx6BXB08 aeRRawOepG43WxGjNLMpaz12gxSgvteHylYg7/FhthA+rr4uXj6S5O2/NdKtKqOLJbFq VuOH7zIhp+nMr38RczKlXk6EcKoPFvVc4l38H2w/57qs0H3N10/+ZmQjZzXKgkcW4Cse X4SceBp+J45kYWSaZMZ2fWYyZs86e0RQ5FFex3P7ACdwAu9VwPCZ6hH409dpu6AmYAIJ taMQ== X-Gm-Message-State: AFuF++kvlSKzvVvEZOn/4Qegs6aIaENNuGL/nSgKxtz5bWsSNoptr6CU ifVp1Vk9h5kDSPSl3HOyMH6YI2kG4701W7L7Xf/C5fLxJ1bgVDAboack X-Gm-Gg: AYBFou1BVgIqBiSdcX/LSpovA7ahAylH/GQlcpt0Xj7pYLds1kAzdLOAT7Mxtj3yqEo IU9WDjblpLST2/VquZjaiLLdba7xiMXn1B9/KDiaYjR9oWmEFMbQpAETHHl6tbt+d3px/TmcXvJ SyNmA6RlsqjCrj61p3m/e4uuRQXu3GJWkkMqln78XkR5lUKR10sIky3sv3Png4PRKqGStBK7NTg OvvvBpsUHMbFbXqgcrNT02OK48Ti0oyDNNGHhyyNdDjApPSDVfCUv5jMQZjabC/tOlCOynaP/iN SKRVPfqqeX/8bkZyyk5C+uPNiLANTj5NzVW+W/z+7FEtYUN6TxH5Ciws3YuQ3pA7t/dicyueYrU recFR8F7WMDzOjtuIiM18XBsp+DKb2iJew9A6S3GlEvrrYrwAUeX4DU9ByHq+httmNyh39ZuruP DGb5Mcl6Q7OwjFkv6U5iC2qJFy9RT0r473L/f/Xmu+Dn0c3frC9awGRMUAu1wqkknU X-Received: by 2002:a05:6102:a146:b0:79b:b389:d6db with SMTP id ada2fe7eead31-79bb3a86689mr2219117137.2.1789488223464; Tue, 15 Sep 2026 09:03:43 -0700 (PDT) Received: from beelink.. ([187.13.206.89]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-982b9fac504sm15052563241.8.2026.09.15.09.03.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 09:03:43 -0700 (PDT) From: Aldo Ariel Panzardo To: Luiz Augusto von Dentz Cc: linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Aldo Ariel Panzardo Subject: [PATCH] Bluetooth: ISO: balance the parent hold in hci_bind_bis() Date: Tue, 15 Sep 2026 13:03:32 -0300 Message-ID: <20260915160332.3107274-1-qwe.aldo@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit hci_conn_link() takes a lifetime reference to its parent with hci_conn_get(), but only takes an operational hold on the child. hci_conn_unlink() later balances both a hold and a reference on the parent. The SCO and CIS paths pass a parent acquired from a connect helper, so it already has a hold. For an additional BIS, hci_bind_bis() obtains the parent from hci_conn_hash_lookup_big(), which returns a bare pointer. Unlinking the child then drops the parent's existing hold and can schedule it for disconnection while its socket is still using it. Take a hold on the parent before linking it and drop that hold if linking fails. A successful link transfers the hold to hci_conn_unlink(). Fixes: fa224d0c094a ("Bluetooth: ISO: Reassociate a socket with an active BIS") Cc: stable@vger.kernel.org Signed-off-by: Aldo Ariel Panzardo --- net/bluetooth/hci_conn.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index b1f911fd4..09a6e0240 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c @@ -2342,10 +2342,13 @@ struct hci_conn *hci_bind_bis(struct hci_dev *hdev, bdaddr_t *dst, __u8 sid, parent = hci_conn_hash_lookup_big(hdev, conn->iso_qos.bcast.big); if (parent && parent != conn) { + hci_conn_hold(parent); link = hci_conn_link(parent, conn); hci_conn_drop(conn); - if (!link) + if (!link) { + hci_conn_drop(parent); return ERR_PTR(-ENOLINK); + } } return conn; -- 2.43.0