Re: [PATCH] can: allow MSG_CMSG_COMPAT flag in recvmsg() syscalls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I should probably split this into two patches when thinking of stable kernels.

E.g. we have to handle two "Fixes:" tags here:

Fixes: 42bf50a1795a ("can: isotp: support MSG_TRUNC flag when reading from socket")

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?

Thanks,
Oliver

On 06.04.23 13:08, Oliver Hartkopp wrote:
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.

Link: https://github.com/hartkopp/can-isotp/issues/59
Cc: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
Suggested-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
Signed-off-by: Oliver Hartkopp <socketcan@xxxxxxxxxxxx>
---
  net/can/isotp.c        | 2 +-
  net/can/j1939/socket.c | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/can/isotp.c b/net/can/isotp.c
index 9bc344851704..fd0e297a8584 100644
--- a/net/can/isotp.c
+++ b/net/can/isotp.c
@@ -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;
diff --git a/net/can/j1939/socket.c b/net/can/j1939/socket.c
index 7e90f9e61d9b..1790469b2580 100644
--- a/net/can/j1939/socket.c
+++ b/net/can/j1939/socket.c
@@ -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);



[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux