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 A8FB84F4D18; Tue, 13 Oct 2026 12:51:17 +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=1791895878; cv=none; b=AodXU7DcOr7lR6Vvz7JP1di4yZfvyMGW2lXMRiL/J1PH9u6QJIvICdNDvnCQimpZHiVphM5RIr4BF0C9jxE3nuxeo2IkeQg0v52SWXxsv1XpBCgJqCWFj7ZT6t1YzqXknI4aD8DUWaUWbZPrV8Hse8dqvSwPSj7/UgnI9b4QDf0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791895878; c=relaxed/simple; bh=ulG/9YcHrpPlwt6+y4BEvCyOUVWYFzzGsjWUvT1hJkc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bUaoSH/vT+mE+TIj0Rmv65QQSgapWFAOC81hATu5/SxevJbwp5tGKrDEbL+W1AxFyYkAjCj4nt16Wmj6BH09RHjk4sapU6pNrd8NeeVSzMyvdqPdcjQO3szugDaGDIXaL7MwZ/Va89Arl4S0KvRUDbNp1B3UU0hSbgWi5gkSp74= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=zimMX5us; 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="zimMX5us" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E76721F000FF; Tue, 13 Oct 2026 12:51:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1791895877; bh=c1astO0salw+88o+yAvyGAP0LcF9P80iVKtlHR8UXfE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=zimMX5usOfXVHCrZoejTq9BNccM9X+a71ZHN14imV8EP6OFJLQ64cUkNLf7Vu9s81 5VOtWnkIm+mlkHCAzzsyjtVU905PL2rYUnBYak1UuxA0g3x7wgZj1/aPy13yrFe8J7 Po4PAvat2JKCmJX9+wWUufWxaq39BacwUpPnJLCs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Mikhail Gavrilov , Maxim Skokov , Luiz Augusto von Dentz Subject: [PATCH 6.12 424/497] Bluetooth: RFCOMM: free the skb when the DLC has no owner Date: Tue, 13 Oct 2026 13:39:51 +0200 Message-ID: <20261013112917.951109208@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261013112907.864180619@linuxfoundation.org> References: <20261013112907.864180619@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.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Maxim Skokov commit 9d1afbf60ed53c5b051cd124153e0ae3078c8b93 upstream. rfcomm_recv_data() hands the skb to d->data_ready() and returns 0 without freeing it, so the callback owns the skb from that point on. The tty implementation frees it when the DLC has been detached from its device: static void rfcomm_dev_data_ready(struct rfcomm_dlc *dlc, struct sk_buff *skb) { struct rfcomm_dev *dev = dlc->owner; if (!dev) { kfree_skb(skb); return; } The socket implementation returns without freeing it, and the skb is leaked. A connected DLC can have no owner: rfcomm_sock_destruct() clears d->owner, while the DLC itself stays on the session until it is closed. Data frames that arrive in that window still find d->state == BT_CONNECTED in rfcomm_recv_data() and are handed to the callback, one leaked skb each. The leak does not stop on its own either. The remote runs out of credits only once RFCOMM_RX_THROTTLED is set, and for a socket the only place that sets it is rfcomm_sk_data_ready() itself, below the return. rfcomm_process_dlcs() keeps granting credits, so the remote keeps sending and the leak keeps growing. Free the skb, as the tty side does. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Reported-by: Mikhail Gavrilov Closes: https://lore.kernel.org/linux-bluetooth/CABXGCsPe5wykd8Aj-hm+SJ7SGQyb8yoGNnx3XDpPmBathj+EGg@mail.gmail.com/ Cc: stable@vger.kernel.org Signed-off-by: Maxim Skokov Assisted-by: Claude:claude-opus-5 Reviewed-by: Mikhail Gavrilov Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Greg Kroah-Hartman --- net/bluetooth/rfcomm/sock.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/net/bluetooth/rfcomm/sock.c +++ b/net/bluetooth/rfcomm/sock.c @@ -50,8 +50,11 @@ static void rfcomm_sock_kill(struct sock static void rfcomm_sk_data_ready(struct rfcomm_dlc *d, struct sk_buff *skb) { struct sock *sk = d->owner; - if (!sk) + + if (!sk) { + kfree_skb(skb); return; + } atomic_add(skb->len, &sk->sk_rmem_alloc); skb_queue_tail(&sk->sk_receive_queue, skb);