From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 12B0C329E7E; Sun, 7 Jun 2026 10:34:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780828465; cv=none; b=kr5cfQ9GS3qFT5H4hC3JHueA99Ie7i9AadmN2nwq2SSikRZz2p9Jbt8hpP8+A8o6yTYYt4mjkDCYsabbBBYWQnmg6MSxEBaH47z9Cc8+WxNLu7wgahyfvHXEZqIhEWixOLq25Wu55yMRRvAgb65btBttgsuqQaY/q0Hc0L+gCKE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780828465; c=relaxed/simple; bh=snR2tEdxJt3d1q3y4F6o7DCPe6ugfzN+fpAUQHfLD5I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fUzHbyjQQtqvAT6Hz0qX6HHlpSNYyF5nCT/KuyAKgnBg1vaE62JkJNbq49yyJya4VfC/S73xENFCsLX1tJfyeMBOgTCnSJFLxeqctNLmQH2cHdF3XBRuX/663wQvcpRBD1V1os2iJfWvI/TupGAeMb4BrKp7SbwCvdNbDUSkFec= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=JZfQvN2T; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="JZfQvN2T" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A2791F00893; Sun, 7 Jun 2026 10:34:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780828464; bh=Pr8JKGxiTpRFnc87illb/VkdGyhGVc6y536aLwp+Mkw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=JZfQvN2ThyD9QlbDkt6GyKC1QS0SU6VJAI0YLt3SxBxuG/PtWh5GXLsDeDGmmzOrj lryPTOYfmPSQqDengSydZiRgiNt4Rli6TDNBBbaeeNmcT0/ULOuvlPFM8J+A9oyMJF JDf1zvq/71dmXqWpQib2oh5/CJSNH5yFZ7YfYfA0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Muhammad Bilal , Luiz Augusto von Dentz Subject: [PATCH 6.18 132/315] Bluetooth: ISO: serialize iso_sock_clear_timer with socket lock Date: Sun, 7 Jun 2026 11:58:39 +0200 Message-ID: <20260607095732.462327653@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260607095727.528828913@linuxfoundation.org> References: <20260607095727.528828913@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Muhammad Bilal commit 4b5f8e608749b7e8fa386c6e4301cf9272595859 upstream. iso_sock_close() calls iso_sock_clear_timer() before acquiring lock_sock(sk). iso_sock_clear_timer() reads iso_pi(sk)->conn twice without the socket lock held: if (!iso_pi(sk)->conn) return; cancel_delayed_work(&iso_pi(sk)->conn->timeout_work); Concurrently, iso_conn_del() executes under lock_sock(sk) and calls iso_chan_del(), which sets iso_pi(sk)->conn to NULL and may result in the final reference to the connection being dropped: CPU0 CPU1 ---- ---- iso_sock_clear_timer() if (conn != NULL) ... lock_sock(sk) iso_chan_del() iso_pi(sk)->conn = NULL cancel_delayed_work(conn) /* NULL deref or UAF */ iso_pi(sk)->conn is not stable across the unlock window, causing a NULL pointer dereference or use-after-free. Serialize iso_sock_clear_timer() with the socket lock by moving it inside lock_sock()/release_sock(), matching the pattern used in iso_conn_del() and all other call sites. Fixes: ccf74f2390d60a2f9a75ef496d2564abb478f46a ("Bluetooth: Add BTPROTO_ISO socket type") Cc: stable@vger.kernel.org Signed-off-by: Muhammad Bilal Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Greg Kroah-Hartman --- net/bluetooth/iso.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/bluetooth/iso.c +++ b/net/bluetooth/iso.c @@ -854,8 +854,8 @@ static void __iso_sock_close(struct sock /* Must be called on unlocked socket. */ static void iso_sock_close(struct sock *sk) { - iso_sock_clear_timer(sk); lock_sock(sk); + iso_sock_clear_timer(sk); __iso_sock_close(sk); release_sock(sk); iso_sock_kill(sk);