Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next 0/7] net: convert remaining bluetooth socket families to getsockopt_iter
@ 2026-05-11 10:41 Breno Leitao
  2026-05-11 10:41 ` [PATCH net-next 1/7] Bluetooth: hci_sock: write the full optval for getsockopt Breno Leitao
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Breno Leitao @ 2026-05-11 10:41 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman,
	Shuah Khan
  Cc: linux-bluetooth, linux-kernel, netdev, linux-kselftest,
	Breno Leitao, kernel-team

Continue the conversion to .getsockopt_iter for the Bluetooth socket
families: hci_sock, ISO, RFCOMM, SCO and L2CAP. The first patch is a
small precursor that fixes a long-standing 1-byte put_user write in
hci_sock_getsockopt_old() so the subsequent conversion stays mechanical.

The riskiest change in this series is the SCO BT_CODEC conversion: it
is the only one that drops an open-coded ptr cursor in favour of
relying on iter_out advancing naturally on every copy_to_iter() call.
Every other socket option is a near-mechanical s/copy_to_user/
copy_to_iter/ rewrite, but BT_CODEC walks a variable-length list of
codecs + capabilities and previously tracked its own write offset by
hand. Getting the cursor semantics wrong here would silently truncate
or misalign user-visible codec data.

To guard against regressions in that specific path, a patch (previous to
the change) extends tools/testing/selftests/net/getsockopt_iter.c with
a focused BT_CODEC test that pre-fills the user buffer with a sentinel
and asserts:

  - the buffer is unchanged on the early error returns (-EBADFD /
    -EOPNOTSUPP, the common case in CI without a controller exposing
    HCI_OFFLOAD_CODECS_ENABLED + a get_data_path_id op), and
  - at least one byte changed on the success path (when a capable
    controller is present), proving the converted copy_to_iter() walk
    actually wrote into user memory.

Signed-off-by: Breno Leitao <leitao@debian.org>
---
Breno Leitao (7):
      Bluetooth: hci_sock: write the full optval for getsockopt
      Bluetooth: hci_sock: convert to getsockopt_iter
      Bluetooth: ISO: convert to getsockopt_iter
      Bluetooth: RFCOMM: convert to getsockopt_iter
      Bluetooth: L2CAP: convert to getsockopt_iter
      selftests: net: getsockopt_iter: cover SCO BT_CODEC conversion
      Bluetooth: SCO: convert to getsockopt_iter

 net/bluetooth/hci_sock.c                      | 26 ++++++-----
 net/bluetooth/iso.c                           | 27 +++++------
 net/bluetooth/l2cap_sock.c                    | 61 +++++++++++++++----------
 net/bluetooth/rfcomm/sock.c                   | 30 +++++++------
 net/bluetooth/sco.c                           | 59 ++++++++++++------------
 tools/testing/selftests/net/getsockopt_iter.c | 65 +++++++++++++++++++++++++++
 6 files changed, 179 insertions(+), 89 deletions(-)
---
base-commit: 63751099502d10f0aa6bb35273e56c5800cc4e3a
change-id: 20260511-getsock_three-d0d7f1b2629e

Best regards,
--  
Breno Leitao <leitao@debian.org>


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-05-11 14:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-11 10:41 [PATCH net-next 0/7] net: convert remaining bluetooth socket families to getsockopt_iter Breno Leitao
2026-05-11 10:41 ` [PATCH net-next 1/7] Bluetooth: hci_sock: write the full optval for getsockopt Breno Leitao
2026-05-11 10:41 ` [PATCH net-next 2/7] Bluetooth: hci_sock: convert to getsockopt_iter Breno Leitao
2026-05-11 10:41 ` [PATCH net-next 3/7] Bluetooth: ISO: " Breno Leitao
2026-05-11 10:41 ` [PATCH net-next 4/7] Bluetooth: RFCOMM: " Breno Leitao
2026-05-11 10:41 ` [PATCH net-next 5/7] Bluetooth: L2CAP: " Breno Leitao
2026-05-11 10:41 ` [PATCH net-next 6/7] selftests: net: getsockopt_iter: cover SCO BT_CODEC conversion Breno Leitao
2026-05-11 13:47   ` Jakub Kicinski
2026-05-11 14:19     ` Breno Leitao
2026-05-11 10:41 ` [PATCH net-next 7/7] Bluetooth: SCO: convert to getsockopt_iter Breno Leitao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox