can: allow MSG_CMSG_COMPAT flag in recvmsg() syscalls
Subsystems (3)
Oliver Hartkopp
maintainerPATCH 1/1 can: allow MSG_CMSG_COMPAT flag in recvmsg() syscalls
The control messages provided by j1939 and isotp support MSG_CMSG_COMPAT but blocked recvmsg() syscalls that have set this flag, e.g. on 32bit ARM systems.
--- net/can/isotp.c | 2 +- net/can/j1939/socket.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/can/isotp.c +1 -1
@@ -1099,11 +1099,11 @@ static int isotp_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,struct sock *sk = sock->sk;struct sk_buff *skb;struct isotp_sock *so =isotp_sk (sk);int ret =0 ; -if (flags & ~(MSG_DONTWAIT |MSG_TRUNC |MSG_PEEK )) +if (flags & ~(MSG_DONTWAIT |MSG_TRUNC |MSG_PEEK |MSG_CMSG_COMPAT ))return -EINVAL ;if (!so->bound)return -EADDRNOTAVAIL ;
net/can/j1939/socket.c +1 -1
@@ -796,11 +796,11 @@ static int j1939_sk_recvmsg(struct socket *sock, struct msghdr *msg,struct sock *sk = sock->sk;struct sk_buff *skb;struct j1939_sk_buff_cb *skcb;int ret =0 ; -if (flags & ~(MSG_DONTWAIT |MSG_ERRQUEUE )) +if (flags & ~(MSG_DONTWAIT |MSG_ERRQUEUE |MSG_CMSG_COMPAT ))return -EINVAL ;if (flags &MSG_ERRQUEUE )return sock_recv_errqueue (sock->sk, msg, size,SOL_CAN_J1939 ,SCM_J1939_ERRQUEUE );
Signature · 1 line
2.30.2
Oliver Hartkopp
maintainerI should probably split this into two patches when thinking of stable kernels.
E.g. we have to handle two "Fixes:" tags here:
@Oleksij: Can you please check if adding this flag is fine for you too - and if you can "ack" it?
Thanks,
Oliver
Quoted 47 lines · Oliver Hartkopp
The control messages provided by j1939 and isotp support
MSG_CMSG_COMPATbut blockedrecvmsg()syscalls that have set this flag, e.g. on 32bit ARM systems.Cc Oleksij Rempel <[email protected]>Suggested-by Marc Kleine-Budde <[email protected]>Signed-off-by Oliver Hartkopp <[email protected]>--- net/can/isotp.c | 2 +- net/can/j1939/socket.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)net/can/isotp.c +1
-1@@ -1099,11 +1099,11 @@ static int isotp_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,struct sock *sk = sock->sk;struct sk_buff *skb;struct isotp_sock *so =isotp_sk (sk);int ret =0 ; -if (flags & ~(MSG_DONTWAIT |MSG_TRUNC |MSG_PEEK )) +if (flags & ~(MSG_DONTWAIT |MSG_TRUNC |MSG_PEEK |MSG_CMSG_COMPAT ))return -EINVAL ;if (!so->bound)return -EADDRNOTAVAIL ;net/can/j1939/socket.c +1
-1@@ -796,11 +796,11 @@ static int j1939_sk_recvmsg(struct socket *sock, struct msghdr *msg,struct sock *sk = sock->sk;struct sk_buff *skb;struct j1939_sk_buff_cb *skcb;int ret =0 ; -if (flags & ~(MSG_DONTWAIT |MSG_ERRQUEUE )) +if (flags & ~(MSG_DONTWAIT |MSG_ERRQUEUE |MSG_CMSG_COMPAT ))return -EINVAL ;if (flags &MSG_ERRQUEUE )return sock_recv_errqueue (sock->sk, msg, size,SOL_CAN_J1939 ,SCM_J1939_ERRQUEUE );
Marc Kleine-Budde
maintainerQuoted 2 lines · Oliver Hartkopp
I should probably split this into two patches when thinking of stable kernels.
+1
Quoted 9 lines
E.g. we have to handle two "Fixes:" tags here:
Fixes 42bf50a1795a ("can: isotp: support MSG_TRUNC flag when reading fromsocket")
Fixes 9d71dd0c7009 ("can: add support of SAE J1939 protocol")@Oleksij: Can you please check if adding this flag is fine for you too - and if you can "ack" it?
Marc
Signature · 4 lines
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 |
Hi Oliver,
Sorry for long delay.
Quoted 2 lines · Oliver Hartkopp
I should probably split this into two patches when thinking of stable kernels.
yes, please.
Quoted 9 lines
E.g. we have to handle two "Fixes:" tags here:
Fixes 42bf50a1795a ("can: isotp: support MSG_TRUNC flag when reading fromsocket")
Fixes 9d71dd0c7009 ("can: add support of SAE J1939 protocol")@Oleksij: Can you please check if adding this flag is fine for you too - and if you can "ack" it?
I tested it on imx8mp with 64bit kernel and 32bit user space. Without this patch "j1939spy -P vcan0" is not working. So, here is my:
Thank you!
Regards,
Oleksij
Signature · 4 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |