netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v3 0/4] net: Fix some callers of copy_from_sockptr()
@ 2024-11-19 13:31 Michal Luczaj
  2024-11-19 13:31 ` [PATCH net v3 1/4] Bluetooth: Improve setsockopt() handling of malformed user input Michal Luczaj
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: Michal Luczaj @ 2024-11-19 13:31 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	David S. Miller, Eric Dumazet, Paolo Abeni, Simon Horman,
	David Howells, Marc Dionne
  Cc: Luiz Augusto von Dentz, linux-bluetooth, netdev, linux-afs,
	Jakub Kicinski, Michal Luczaj, David Wei

Some callers misinterpret copy_from_sockptr()'s return value. The function
follows copy_from_user(), i.e. returns 0 for success, or the number of
bytes not copied on error. Simply returning the result in a non-zero case
isn't usually what was intended.

Compile tested with CONFIG_LLC, CONFIG_AF_RXRPC, CONFIG_BT enabled.

Last patch probably belongs more to net-next, if any. Here as an RFC.

Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Michal Luczaj <mhal@rbox.co>
---
Changes in v3:
- rxrpc/llc: Drop the non-essential changes
- rxrpc/llc: Replace the deprecated copy_from_sockptr() with
  copy_safe_from_sockptr() [David Wei]
- Collect Reviewed-by [David Wei]
- Link to v2: https://lore.kernel.org/r/20241115-sockptr-copy-fixes-v2-0-9b1254c18b7a@rbox.co

Changes in v2:
- Fix the fix of llc_ui_setsockopt()
- Switch "bluetooth:" to "Bluetooth:" [bluez.test.bot]
- Collect Reviewed-by [Luiz Augusto von Dentz]
- Link to v1: https://lore.kernel.org/r/20241115-sockptr-copy-fixes-v1-0-d183c87fcbd5@rbox.co

---
Michal Luczaj (4):
      Bluetooth: Improve setsockopt() handling of malformed user input
      llc: Improve setsockopt() handling of malformed user input
      rxrpc: Improve setsockopt() handling of malformed user input
      net: Comment copy_from_sockptr() explaining its behaviour

 include/linux/sockptr.h           |  2 ++
 include/net/bluetooth/bluetooth.h |  9 ---------
 net/bluetooth/hci_sock.c          | 14 +++++++-------
 net/bluetooth/iso.c               | 10 +++++-----
 net/bluetooth/l2cap_sock.c        | 20 +++++++++++---------
 net/bluetooth/rfcomm/sock.c       |  9 ++++-----
 net/bluetooth/sco.c               | 11 ++++++-----
 net/llc/af_llc.c                  |  2 +-
 net/rxrpc/af_rxrpc.c              |  7 ++++---
 9 files changed, 40 insertions(+), 44 deletions(-)
---
base-commit: 66418447d27b7f4c027587582a133dd0bc0a663b
change-id: 20241114-sockptr-copy-fixes-3999eaa81aa1

Best regards,
-- 
Michal Luczaj <mhal@rbox.co>


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

end of thread, other threads:[~2024-12-02 21:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-19 13:31 [PATCH net v3 0/4] net: Fix some callers of copy_from_sockptr() Michal Luczaj
2024-11-19 13:31 ` [PATCH net v3 1/4] Bluetooth: Improve setsockopt() handling of malformed user input Michal Luczaj
2024-11-19 13:31 ` [PATCH net v3 2/4] llc: " Michal Luczaj
2024-11-19 13:31 ` [PATCH net v3 3/4] rxrpc: " Michal Luczaj
2024-11-19 13:31 ` [PATCH net v3 4/4] net: Comment copy_from_sockptr() explaining its behaviour Michal Luczaj
2024-11-26  9:00 ` [PATCH net v3 0/4] net: Fix some callers of copy_from_sockptr() Paolo Abeni
2024-11-26 14:57   ` Luiz Augusto von Dentz
2024-11-28  8:30 ` patchwork-bot+netdevbpf
2024-11-29 17:04 ` [PATCH net v3 3/4] rxrpc: Improve setsockopt() handling of malformed user input David Howells
2024-12-02 21:40 ` [PATCH net v3 0/4] net: Fix some callers of copy_from_sockptr() patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).