From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.217.47 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796398277; b=avESt2QsN/LfMf0uMmDuQ4A5ozPaNJ74djM+OIQv4SLkKjUwxVjZyxHTYQcJBxTY8X8N 5TBCzumc04IOs3KWoGVccDpb2HCPZ2FNOLY5hlpIlqGcDqQuct9OtmVm4G5PM4Drk0EhR G/AN7umCsOtlRo8PH/qOPRUalrEvR6jbDq01+oYoGmdg8LhY9/RWlUf0xiFyKfv1RCWda pRA2h32Kj0y8LjUjKxHgbuLMktGUk/Fv2Ln6W+8cXknScmjdCXXrRDVU7w21eJO5aAlw7 UwNM+8ZnO+jxYkqOrMNPpByM/eAiVAurYw4+wG+bS7Rc4jbP5X8NBs3Z8WAkBSuBMHA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796398277; 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=MFOgV7T+eQ+Ph1bUryKE41lUZdUBkQwchvhGN3krun4=; b=eNTmwdpxNGWp3DbnvX8ZO2Ni/WTXBkpuAuWy9AQvON8vbnkBzh1978F1qJ8KWFFBc/rm DaHWk7nRK7uQHFxONusnXQWJmHFo7fZmiYj1Ah1mI/Fc1Fg9NB97iYNc9ZUNljMrop1Yn Fekq5YUn4wq1VquGIQHKZcsaDTOtlIT4CnhaUHfktf0ToRIJKjvNClXkWiyHdAHUfd1Dy ddik0b6JZFs7nITzJSG0EhwCLY3KH9O9TkCiKeQpT2AhXh6masidHmzUe5H54CDcd8Xqd /ZAXLJfcgRuBtdXx4ouWTHLE5UlF4bMX/SljAvTDvotB3XWzha3aYAUQ0MvdZkMBKgg== 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=gEE1xJvY; arc=none smtp.remote-ip=209.85.217.47 Received: from mail-vs1-f47.google.com (mail-vs1-f47.google.com [209.85.217.47]) (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 F3AF3606A322 for ; Fri, 4 Dec 2026 15:31:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F3AF3606A322 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=gEE1xJvY Received: by mail-vs1-f47.google.com with SMTP id ada2fe7eead31-7d2ca055399so338619137.3 for ; Fri, 04 Dec 2026 07:31:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796398276; x=1797003076; 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=MFOgV7T+eQ+Ph1bUryKE41lUZdUBkQwchvhGN3krun4=; b=gEE1xJvY0lVoAqEQ+UW4lfDyMdkslJwStkh2nR0+aBGdi9OeGaCdj03ammBfS8mXxp i43KVLJpZBy3W9fpeQFnokW+YfOwiTGUCn9oU65jMb0l4PvgJ7vYJtoSjrEAcEmJCh5d PYX083VvUXtIdKrEElhyRtfwwXnjOi2bfFo7PmXHm4XlXJsURvRyeLXU+BleBewonZfz 8P9r9yF/lQMn5ww6n374AgbVzw3BPTLCg0SyrS44WIkOWs8/t+pukIeX9aEicEXntgMy mTUTYdug6uTqz9g8wnaJPe/jp2kRXiDtbebDvQYExaQThWl/PxpZwUgW2pynZLQmcHyN lThw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796398276; x=1797003076; 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=MFOgV7T+eQ+Ph1bUryKE41lUZdUBkQwchvhGN3krun4=; b=0Qnj8hpSzupDUhP1LAxqVXW8fJymtxO9N2gIOG9wYAtZTywukL5Rzi/3cor8/nws9p gcffDWhBwBmNBLstelLS8y2Y2b6YvZt9imvrZopLpSjy4BFz27M8HnNxmAMA4z29j/OF 2JdcaMh84DdWvhEp3D1DqUPwhEwdUJZEFRUBtUvpz83c7RZSeBUKktwTZbUmEEuFSDoB y/WKG/9BciuebtZu5sRo8rsv4o6De4Z7CtxlbVVlqWJv6VTfPFtTgZVfY2hp4+of6ndg iAT9KWmnJUhQ2le9QEW51KB8FwZ7AveNVjSTpjvXQsyr2RS7azz4oduqeD85MPWp95ht KJcA== X-Gm-Message-State: APuU4Z8iTHeMfrFYuPuebqpuX9eaaGkWNx6ZecjGylMB5Ah2I6X+CFFk xlAIqUrzYNwJGnJVmuQqrxCTouIz3eKEjAoXGVLzbx7jUfoOqsnRyd6dhfnhBb/x X-Gm-Gg: AZFdTZfTb5uHwd3Qp9LbZp9zUXHFhrNzrTpZhTa9USp3bzC5eYLEs6cQUaB+IltaRa3 lbtxMWh2j4sm8HFpAdIobB8myzUe5dpns2j9SIjQ0DPlOSJ13sopwg9pULEg81XnL9o7FiuCYSg npi8uYubV7ycgJgNJjbydZZMpbAyYNHcYSL5h2dMSFKq5u/GhJJtYIJtColp8DUWkNjFAH8BCXR EmXrPUBRIN9XIHWbMUvJazNIsCdf9m2qEpH5PskkFAAXRp0b02k8DWK+3Fo8/gdCNbf1ndjrrZF omuiUem2EWZGKPtQOGKVLHt34v5i5NdVYOTFfKXCeb6P+DrVcCN41bPhI7BvurlU0Qf4cB8mFjZ qQyxNKBejkUngfogEgRIpAuGHY94g53lcFLZ8wUMNiK6NQjuXloyjZi698a5fklOAMtW+Mou0hr SlfibUj5VX33BNiPiVFJQzM05Wx4wrFp6ZosK4tKMHWNFoL5EMpM+eI0br2Kc23ZG/SZ7qmmJyA kOUkEG4bJUX7V9zkkw0QHidquZQr1HtmUar8O5pkZKnQ/Jzw9HKvDedGyYCPKjJB+PaY46g7N4a JqfG4wVjWdEmFTQNJI5wwQaX0feFwlY2cYdR0L0f7IkFBXxZfZaGFwhGVpA4IlJcX/dFIsL0BpJ n+aQTDSgnL0DckJ314kKWTWlpxiVsredB4ACQKjOchUevNPMReMM3YmA= X-Received: by 2002:a05:6102:418f:b0:7b3:7653:5487 with SMTP id ada2fe7eead31-7daec89db6cmr1882215137.32.1796398275715; Fri, 04 Dec 2026 07:31:15 -0800 (PST) Received: from lvondent-mobl5 ([72.188.211.115]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-7dae927925csm1347436137.0.2026.12.04.07.31.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 07:31:15 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v20 0/2] Bluetooth: L2CAP: Fix LE credits resuming channels pending security Date: Fri, 4 Dec 2026 10:31:03 -0500 Message-ID: <20261204153105.1183145-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 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. v19: https://lore.kernel.org/linux-bluetooth/20261204140210.1149344-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 | 13 +++++ net/bluetooth/l2cap_core.c | 89 +++++++++++++++++++++++++++++++---- net/bluetooth/l2cap_sock.c | 37 +++++++++++++-- 3 files changed, 128 insertions(+), 11 deletions(-) -- 2.56.1