From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5995A228CB0; Mon, 13 Oct 2025 15:40:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760370041; cv=none; b=gM9jxxA+k3reW5Gnuh1xOpc7Zxi7dVYFIUJ31RTOm35nchPwfF/XQn4Vv9iwXFKiUvoETVcsznetIH4SkxaSIlDL0Y87MYLuhADkCT+mmEN31bqctJekuYN/xPFt/uvqnWJBbk/xRQi2s87fL1RPzK4SafXYdK6/bYzTS+0Ge/M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760370041; c=relaxed/simple; bh=KnGLTcD8h/hlexYLi3B513/phJ9/fqTd9o6E6DACPMk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=j9chWSeQcnPj15IIdKCxAssjRAbdmOcsHh0R6UijDV+CErt8ETYoqf3DNw065nu50YFs5II6P2mIRJHf2pPgSkldKBGPwnOy2NLtEVvAc97xQfeksk1M2+4ZJqWFN891edsOrs2MSz7V08h1k0OnDXb2PU1TrnLwcT24DyZ+X10= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Y6TuGhYX; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Y6TuGhYX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 902C7C4CEE7; Mon, 13 Oct 2025 15:40:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760370040; bh=KnGLTcD8h/hlexYLi3B513/phJ9/fqTd9o6E6DACPMk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y6TuGhYXSOz+midqxqnYJljLVfYsE7Z913YvPxWSFJCYlFR/MIgPhW3hmfnr4idu8 mEYLYPhW+Wv5e1wH+IMLA25lJVOQxXMm5e6X4RDV5z5TlCx7uvK/H0XAPIrVooM/sg EEu6l+As4GjcfhXi1amsQ8hBkEWPNcYLw5fMJ+yM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 6.17 458/563] Bluetooth: ISO: Fix possible UAF on iso_conn_free Date: Mon, 13 Oct 2025 16:45:19 +0200 Message-ID: <20251013144427.877235780@linuxfoundation.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251013144411.274874080@linuxfoundation.org> References: <20251013144411.274874080@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.17-stable review patch. If anyone has any objections, please let me know. ------------------ From: Luiz Augusto von Dentz [ Upstream commit 9950f095d6c875dbe0c9ebfcf972ec88fdf26fc8 ] This attempt to fix similar issue to sco_conn_free where if the conn->sk is not set to NULL may lead to UAF on iso_conn_free. Fixes: ccf74f2390d6 ("Bluetooth: Add BTPROTO_ISO socket type") Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- net/bluetooth/iso.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/net/bluetooth/iso.c b/net/bluetooth/iso.c index 5ce823ca3aaf4..c047a15e3fa39 100644 --- a/net/bluetooth/iso.c +++ b/net/bluetooth/iso.c @@ -750,6 +750,13 @@ static void iso_sock_kill(struct sock *sk) BT_DBG("sk %p state %d", sk, sk->sk_state); + /* Sock is dead, so set conn->sk to NULL to avoid possible UAF */ + if (iso_pi(sk)->conn) { + iso_conn_lock(iso_pi(sk)->conn); + iso_pi(sk)->conn->sk = NULL; + iso_conn_unlock(iso_pi(sk)->conn); + } + /* Kill poor orphan */ bt_sock_unlink(&iso_sk_list, sk); sock_set_flag(sk, SOCK_DEAD); -- 2.51.0