public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/5] net: convert four more protocols to getsockopt_iter
@ 2026-05-05 11:12 Breno Leitao
  2026-05-05 11:12 ` [PATCH net-next 1/5] can: isotp: convert " Breno Leitao
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Breno Leitao @ 2026-05-05 11:12 UTC (permalink / raw)
  To: Oliver Hartkopp, Marc Kleine-Budde, Robin van der Gracht,
	Oleksij Rempel, kernel, Jeremy Kerr, Matt Johnston,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Shuah Khan
  Cc: linux-can, linux-kernel, netdev, linux-kselftest, Breno Leitao,
	kernel-team, Stanislav Fomichev, Bobby Eshleman

Continue the work to convert protocols to the new getsockopt_iter API.

Convert four additional getsockopt implementations to the new
sockopt_t/getsockopt_iter callback:

  - CAN ISO-TP
  - MCTP
  - CAN J1939
  - LLC

These are mechanical, ABI-preserving conversions following the same
pattern as the previously converted protocols (af_packet, can/raw,
af_netlink, af_vsock): the (char __user *optval, int __user *optlen)
pair is replaced with a single sockopt_t *opt that carries the buffer
length on input and the returned size on output, and exposes an iov_iter
for the copy-out path. put_user()/copy_to_user() pairs are replaced with
a single copy_to_iter() per option, and the wrapper in
do_sock_getsockopt() handles writing optlen back to userspace.

I picked these four because each is small and self-contained, with only
one getsockopt callback and a handful of options, so the conversions are
easy to audit individually.

NOTE: optlen is always updated (returned to userspace) even when optval
fails to copy. I.e, userspace will get the "new" optlen even when the
getsockop() fails. That seems wrong, but, this just preserve the
previous behaviour, not changing it.

Signed-off-by: Breno Leitao <leitao@debian.org>
---
Breno Leitao (5):
      can: isotp: convert to getsockopt_iter
      can: j1939: convert to getsockopt_iter
      mctp: convert to getsockopt_iter
      llc: convert to getsockopt_iter
      selftests: net: getsockopt_iter: address review nits

 net/can/isotp.c                               |  12 ++-
 net/can/j1939/socket.c                        |  21 +++--
 net/llc/af_llc.c                              |  15 ++--
 net/mctp/af_mctp.c                            |  10 +--
 tools/testing/selftests/net/getsockopt_iter.c | 109 +++++++++++++++++++++++---
 5 files changed, 128 insertions(+), 39 deletions(-)
---
base-commit: c1e5127b577c6b88fa48e532616932ae978528d5
change-id: 20260505-getsock_two-abad19643336

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


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

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

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-05 11:12 [PATCH net-next 0/5] net: convert four more protocols to getsockopt_iter Breno Leitao
2026-05-05 11:12 ` [PATCH net-next 1/5] can: isotp: convert " Breno Leitao
2026-05-05 11:12 ` [PATCH net-next 2/5] can: j1939: " Breno Leitao
2026-05-05 11:12 ` [PATCH net-next 3/5] mctp: " Breno Leitao
2026-05-05 11:12 ` [PATCH net-next 4/5] llc: " Breno Leitao
2026-05-05 11:12 ` [PATCH net-next 5/5] selftests: net: getsockopt_iter: address review nits Breno Leitao

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