Thread (8 messages) 8 messages, 6 authors, 2025-01-16

Re: [PATCH] net: Convert proto_ops::getname to sockaddr_storage

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: 2025-01-16 07:54:56
Also in: gfs2, linux-arm-msm, linux-bluetooth, linux-can, linux-cifs, linux-hams, linux-hardening, linux-nfs, linux-nvme, linux-rdma, linux-s390, linux-scsi, linux-sctp, linux-security-module, lkml, ocfs2-devel, target-devel, virtualization

On 16.12.2024 18:34:28, Kees Cook wrote:
The proto_ops::getname callback was long ago backed by sockaddr_storage,
but the replacement of it for sockaddr was never done. Plumb it through
all the getname() callbacks, adjust prototypes, and fix casts.

There are a few cases where the backing object is _not_ a sockaddr_storage
and converting it looks painful. In those cases, they use a cast to
struct sockaddr_storage. They appear well bounds-checked, so the risk
is no worse that we have currently.

Other casts to sockaddr are removed, though to avoid spilling this
change into BPF (which becomes a much larger set of changes), cast the
sockaddr_storage instances there to sockaddr for the time being.

In theory this could be split up into per-caller patches that add more
casts that all later get removed, but it seemed like there are few
enough callers that it seems feasible to do this in a single patch. Most
conversions are mechanical, so review should be fairly easy. (Famous
last words.)

Signed-off-by: Kees Cook <kees@kernel.org>
---
 net/can/isotp.c                               |  3 +-
 net/can/j1939/socket.c                        |  2 +-
 net/can/raw.c                                 |  2 +-
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de> # for net/can

regards,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde          |
Embedded Linux                   | https://www.pengutronix.de |
Vertretung Nürnberg              | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-9   |

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help