From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.222.46 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796416163; b=5q/pm+/r4u+FuE6wHIXT5tGUa0COpUiyVdWTpX4bhVXSqKKLz0lnDJOzGofwBgy2X3wv YRoRKWC2qSRDOjJxu1hgw10Az0geJPJjRpny6mHikY4xEyyatUz1gHFxqNZ/mNn5n3w73 DxFTjhnxH0MErselgh9BaK+gHsYxIuFqk6x7QENNQwk1HVXGfdgiBE/4uH+xsWFhejNja OYHZSmepF8MoHrdjzZgJAEy5Ys9/Z9Br/pQWjS2cMIollPg89XtdzVCr63OV1e9lzUBjM omCJVFCLBIiGjmv+fFcpGtidDZNzl4oHuP2/zzmFUZuWNhHA8D5KLll1uuSBk2yvKSg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796416163; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Subject:Date: Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=9YoCDmgnK5TbxqdHGTV9iDhHfDtt2KhQH1VSeugYFIM=; b=OQc6iVYvvh+j2WaK1TvgCWstky1q5ZaPCdXON2bEbfelOAAGp3lAQBF77gKfUqxroZJJ n0FPOJMQGn1c5M3G9tYjKH5UOgsYKWl+Sz0HWrb5guyJzoqabKUCLtSkan0vXnw0E2Ufo UoJx5EGDJAKFIA9Ik6jWjuPW80KOGRm09SfnDe00tS06/SJPD0Romwa/t0+ad4GTc+tcg BS30CQI42z3gL3WX6wSUQRQ49G0ls7H9Jmz7OP2EhAAEt+sfkwWQaITCULfWfxiYfTgC9 U64cjDwhrGbSBZSkgfgL11ILZDRriFwcTCNfoIhZuQH01IGA0CxzjXuY+yZantmXyaA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=lTHx8zhi; arc=none smtp.remote-ip=209.85.222.46 Received: from mail-ua1-f46.google.com (mail-ua1-f46.google.com [209.85.222.46]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF168606A32F for ; Fri, 4 Dec 2026 20:29:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DF168606A32F 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.a=rsa-sha256 header.s=20260707 header.b=lTHx8zhi Received: by mail-ua1-f46.google.com with SMTP id a1e0cc1a2514c-99c042cee7dso690978241.1 for ; Fri, 04 Dec 2026 12:29:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796416162; x=1797020962; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=9YoCDmgnK5TbxqdHGTV9iDhHfDtt2KhQH1VSeugYFIM=; b=lTHx8zhibk7rEI5BTiwNW/gwZP7Pv2LuvCm34rKBn8HnvURCZzTxp7H4SLP4+IfGHf 605VN1fzyOGcev3oBPAOkFAKhl1iE8n3KVJzPI/QmUFaWh77HMxXBjmczK98tOcI0g0B U07ywhnYtyYzmkuv/N2Vsur6qC77oCi/4OtBgZnES5NEE9QoteP3TFzZa29GniRNlpD1 jlQ7LhEHJveFWEzWglZxodZz1o7vPRScYa21mpPu4utek0YzdMKLXNbbYOJIEakJ+DHp XLiMchzkD8lP46BmsdoXtzcJ0X09t3miZCFZKySxD5ncasJGQm1/0jfLOqRRXmqYXrSg Mgyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796416162; x=1797020962; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=9YoCDmgnK5TbxqdHGTV9iDhHfDtt2KhQH1VSeugYFIM=; b=dXpsOmdxfjDpHzKzf9pGZEO58d+Owj7iytugB5YlBLBHES/LEyIsi56ouPS1YmlkGr x+ZJGTqw9nhOFx+QYGi9mwOPGgSlqWM+mDvNUE26O0aovNTDI+lI0Xp1xxZoR7AtMOPe U57psX3fWTeO96Zb6b2aXwolCGXDNf1aHZFxGiIMacFLc7bv1o/sG8bAyhzF4yApagYE QrrL//tjo21rAfIHI+uVHJM4431PkBy+bgYTqiLBfI8NGgU5fy3YhN9rIzB1ZttPZE6t JyAO6Etcbe6fZFd7d6pPM5KNIM5akdBtVv9znZzvCM6iV13RKv4i0WB0Fy8q2riRefQq z2Cg== X-Gm-Message-State: APuU4Z+GN7zso1RpoweseQALq0C40FSmfSlAGbWMGvMfP5YuArd7qzWP 2siQCnZA2ZY6/0OLB7ZC8AjBeRY1wAknVD6A8QIq/k6N6pf4ANHeWhk/5XjwgwfJ X-Gm-Gg: AZFdTZeYJU2OLnKCfEYt37oK9nPtGCgbOnD+nippJlbIgQfw4eUSVAHc+g33ooWH+30 Gk/Clo4r54jVGynjVNOF66Y7LeS3M7s9SBlFzj2zohvFjlKfAFCvwG0x6zP4XbKB/iCMLqCzpz9 2R7KD9k8nabl71G1Vjk2KofNbM6olBKxbHEpJ8N84OQftLZrsjMfqQp2hUSN19dmik5BtH7Gkgf dxhRBshQvJstZl/rg5sqZGt3YgltGG3kNjI6FLfR+hpCvQUxhK+BvL6QcLaHgOWt/4nRAyjh2Ju zQJ+y0P3/E30JR+RlXFeuvTMXXIzXQH1vgXz1dNgu204rWJdr9I8qjaxyL1ztiLSSiY66jIQPvD OdqUPJdmKFonLJAvyC7yXfbmxps5Bi8sQveYVvSvP0RklUyKlPPBI2ycfHg8r4jh/KYF1KCzAif lxucf125IMcO3KnpiaO1/iFRxexSXgRk6Gzc07ObWAYETYvadSC4+1lY+L2WkPkcaKv44VzMxxT CbfL7ro+GwBL9L6lE6qoYqTDi1TfK0vJWUBZXuQKQwUIvDHW2ZdwUc15o8o+sGEgOkxdjohLUXI myqCifgmi1gV3NhofbofMqZA1tn6TxmtVdwcnEm9Z1zIqXyYgV4QEgYJ/P3t3AGa/hTUhep0QpL aunM3ri0mL/G8RwRS4scS87OJDe0AaSEnXaesGnVLwvcaf4bmAAlbhI0= X-Received: by 2002:a05:6102:424f:b0:7d2:d9f8:21cf with SMTP id ada2fe7eead31-7daec83b9cfmr3135834137.29.1796416161824; Fri, 04 Dec 2026 12:29:21 -0800 (PST) Received: from lvondent-mobl5 ([72.188.211.115]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-7dae97bd767sm1473104137.10.2026.12.04.12.29.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 12:29:21 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v21 0/2] Bluetooth: L2CAP: Fix LE credits resuming channels pending security Date: Fri, 4 Dec 2026 15:29:10 -0500 Message-ID: <20261204202912.1336184-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.56.1 X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Luiz Augusto von Dentz An LE Flow Control Credit packet resumes the channel, which on a CoC waiting for a security upgrade requested with BT_SECURITY drains queued data and clears the socket suspension before the upgrade completes. While the upgrade is pending, an established CoC is now moved to BT_CONFIG with FLAG_PENDING_SECURITY set, like ATT, so credits are only accounted, not acted upon, and the existing l2cap_security_cfm() path resumes or closes the channel once the upgrade completes. This set has a companion userspace set for BlueZ adding l2cap-tester cases covering it: [PATCH BlueZ v1 0/2] l2cap-tester: Add tests for changing LE security with SMP pending Changes in v21: - Only move connection oriented channels to BT_CONFIG, LE raw sockets have no credits to resume them once the upgrade completes. - Don't treat an established channel waiting for a security upgrade as refused when checking the ident of an Enhanced Credit Based request. - Rebase on bluetooth-next. Changes in v20: - Read the channel state under its lock in l2cap_chan_connect(), so connect() returning EISCONN doesn't race with BT_SECURITY. Changes in v19: - Ignore credits for an Enhanced Credit Based channel whose response has not been sent, the peer doesn't know its CID yet. - Only clear FLAG_DEFER_SETUP of a sibling under its lock when sending the Enhanced Credit Based response, so BT_SECURITY can't move it to BT_CONFIG after seeing the response pending. - Only complete a pending upgrade from BT_SECURITY if the link meets the security level of the channel. - Return EISCONN from connect() while an upgrade is pending. - Check for a NULL socket in l2cap_sock_suspend_cb(). Changes in v18: - Ignore credits on non connection oriented channels. - Don't move an Enhanced Credit Based channel whose response has not been sent to BT_CONFIG. - Let senders racing with BT_SECURITY queue data while the upgrade is pending instead of failing with ENOTCONN. - Return the RX credits not returned while the upgrade was pending, and only resume the socket once the held data is sent and credits remain. - Complete a pending upgrade when BT_SECURITY sets a level the link already meets. - Don't claim key size and MIC are enforced in the commit message. v20: https://lore.kernel.org/linux-bluetooth/20261204153105.1183145-1-luiz.dentz@gmail.com/ Kyle Pepper (2): Bluetooth: L2CAP: Restrict LE credits to connected CoCs Bluetooth: L2CAP: Keep credits from completing security upgrades include/net/bluetooth/l2cap.h | 14 ++++++ net/bluetooth/l2cap_core.c | 95 ++++++++++++++++++++++++++++++++--- net/bluetooth/l2cap_sock.c | 38 ++++++++++++-- 3 files changed, 136 insertions(+), 11 deletions(-) -- 2.56.1