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 D3D3D4E36D4; Thu, 17 Sep 2026 18:08:36 +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=1789668518; cv=none; b=eRSYc8mTV/Zej+4I7pj5ORw6aJDJOTV2fK5iMs9ALUgj2GOrUqnwWbLBNzyhNtAHp4xkEfonqQ5qk+1ktSrA5ucKXFbGuUnz2d8tMHZQb9Kd7brZ9LYASvRoTKuf/XblPFJ6i1B8FsQr1AAFoVcd3eUUMoeoYQEGLOFgXmUNDD0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789668518; c=relaxed/simple; bh=KicL0EzoC/nI8Ze4R39TRpFkF/of2kMV9pFZZYKhK9A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WtZ5EAq9hHd+mAE8ZnCorKcTkiXMLY2nPk5YCEOt+xOnTmCAfTDy0WgbT+Q8bA7BCvr6DuWHrzhdsa51HUjQUCA4RdoF+O5E7BCsRJPFhhMUYcgO1rQpZE+Ls16gtTd23pk+k0O5xBs2NG03A1T/LgxbloYAzvwyBHr9kCUHWGs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=dwaa8oT7; 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="dwaa8oT7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF5861F000FF; Thu, 17 Sep 2026 18:08:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789668516; bh=7WHD1aCL6ZY5NhVBTMXJjLi9P3/L0hTVXuT2TWU+3zI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=dwaa8oT7+w+OxI3w2ba1SjzyOIcLnwb5k2i6mgGGNHcxM28u8owVGopaY0IzljlVh w9EbNlBSNO2j2gaDhNwstqH2W89d9ctsiqimCv0er/6ET90as2BsKlKFWvq2DQwxwu RIHr0v6/hxmcNqlXF2wWknS3SPnjMRLu6Nu+Cs8Y= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jiale Yao , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 6.12 0449/1102] Bluetooth: RFCOMM: validate skb length in rfcomm_recv_frame Date: Thu, 17 Sep 2026 16:06:32 +0100 Message-ID: <20260917151550.955867431@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260917151539.408551884@linuxfoundation.org> References: <20260917151539.408551884@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: Jiale Yao [ Upstream commit b230e5bf501c5edaf2eb0991cb862ac142031d4b ] rfcomm_recv_frame() casts skb->data to struct rfcomm_hdr and dereferences hdr->addr and hdr->ctrl without validating skb->len first. A truncated frame with skb->len less than the minimum header size causes an out-of-bounds read of uninitialized memory. Additionally, a zero-length frame causes skb->len-- to underflow to UINT_MAX, making skb_tail_pointer() read far past the buffer. Commit 23882b828c3c ("Bluetooth: RFCOMM: validate skb length in MCC handlers") fixed the same class of missing-length-check bugs in the MCC sub-handlers, but the top-level rfcomm_recv_frame() was left unfixed. KMSAN reports: BUG: KMSAN: uninit-value in rfcomm_run ... Uninit was created at: __alloc_skb+0x474/0xb60 vhci_write+0xe9/0x870 Fix this by rejecting frames smaller than sizeof(struct rfcomm_hdr) + 1 (the minimum frame must have a 3-byte header and a 1-byte FCS). Signed-off-by: Jiale Yao Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- net/bluetooth/rfcomm/core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index 676989ff75737..5dc575833371a 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c @@ -1817,6 +1817,11 @@ static struct rfcomm_session *rfcomm_recv_frame(struct rfcomm_session *s, return s; } + if (skb->len < sizeof(*hdr) + 1) { + kfree_skb(skb); + return s; + } + dlci = __get_dlci(hdr->addr); type = __get_type(hdr->ctrl); -- 2.53.0