Commit e6b6c7ee authored by Olaf Hering's avatar Olaf Hering Committed by Linus Torvalds

[NET]: Fix compat bug in recvmsg/sendmsg wrt MSG_CMSG_COMPAT.

parent 21eca083
...@@ -1567,7 +1567,7 @@ static int atalk_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr ...@@ -1567,7 +1567,7 @@ static int atalk_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr
struct atalk_route *rt; struct atalk_route *rt;
int err; int err;
if (flags & ~MSG_DONTWAIT) if (flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT))
return -EINVAL; return -EINVAL;
if (len > DDP_MAXSZ) if (len > DDP_MAXSZ)
......
...@@ -1413,9 +1413,8 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -1413,9 +1413,8 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
size_t size; size_t size;
int lv, err, addr_len = msg->msg_namelen; int lv, err, addr_len = msg->msg_namelen;
if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR)) { if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT))
return -EINVAL; return -EINVAL;
}
lock_sock(sk); lock_sock(sk);
ax25 = ax25_sk(sk); ax25 = ax25_sk(sk);
......
...@@ -1905,7 +1905,7 @@ static int dn_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -1905,7 +1905,7 @@ static int dn_sendmsg(struct kiocb *iocb, struct socket *sock,
unsigned char fctype; unsigned char fctype;
long timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT); long timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT);
if (flags & ~(MSG_TRYHARD|MSG_OOB|MSG_DONTWAIT|MSG_EOR|MSG_NOSIGNAL|MSG_MORE)) if (flags & ~(MSG_TRYHARD|MSG_OOB|MSG_DONTWAIT|MSG_EOR|MSG_NOSIGNAL|MSG_MORE|MSG_CMSG_COMPAT))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (addr_len && (addr_len != sizeof(struct sockaddr_dn))) if (addr_len && (addr_len != sizeof(struct sockaddr_dn)))
......
...@@ -274,8 +274,8 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -274,8 +274,8 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
* Check the flags. * Check the flags.
*/ */
if (msg->msg_flags&~MSG_DONTWAIT) if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT))
return(-EINVAL); return -EINVAL;
/* /*
* Get and verify the address. * Get and verify the address.
......
...@@ -1695,7 +1695,7 @@ static int ipx_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -1695,7 +1695,7 @@ static int ipx_sendmsg(struct kiocb *iocb, struct socket *sock,
/* Socket gets bound below anyway */ /* Socket gets bound below anyway */
/* if (sk->sk_zapped) /* if (sk->sk_zapped)
return -EIO; */ /* Socket not bound */ return -EIO; */ /* Socket not bound */
if (flags & ~MSG_DONTWAIT) if (flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT))
goto out; goto out;
/* Max possible packet size limited by 16 bit pktsize in header */ /* Max possible packet size limited by 16 bit pktsize in header */
......
...@@ -1269,7 +1269,7 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -1269,7 +1269,7 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket *sock,
IRDA_DEBUG(4, "%s(), len=%d\n", __FUNCTION__, len); IRDA_DEBUG(4, "%s(), len=%d\n", __FUNCTION__, len);
/* Note : socket.c set MSG_EOR on SEQPACKET sockets */ /* Note : socket.c set MSG_EOR on SEQPACKET sockets */
if (msg->msg_flags & ~(MSG_DONTWAIT | MSG_EOR)) if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT))
return -EINVAL; return -EINVAL;
if (sk->sk_shutdown & SEND_SHUTDOWN) { if (sk->sk_shutdown & SEND_SHUTDOWN) {
...@@ -1521,7 +1521,7 @@ static int irda_sendmsg_dgram(struct kiocb *iocb, struct socket *sock, ...@@ -1521,7 +1521,7 @@ static int irda_sendmsg_dgram(struct kiocb *iocb, struct socket *sock,
IRDA_DEBUG(4, "%s(), len=%d\n", __FUNCTION__, len); IRDA_DEBUG(4, "%s(), len=%d\n", __FUNCTION__, len);
if (msg->msg_flags & ~MSG_DONTWAIT) if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT))
return -EINVAL; return -EINVAL;
if (sk->sk_shutdown & SEND_SHUTDOWN) { if (sk->sk_shutdown & SEND_SHUTDOWN) {
...@@ -1593,7 +1593,7 @@ static int irda_sendmsg_ultra(struct kiocb *iocb, struct socket *sock, ...@@ -1593,7 +1593,7 @@ static int irda_sendmsg_ultra(struct kiocb *iocb, struct socket *sock,
IRDA_DEBUG(4, "%s(), len=%d\n", __FUNCTION__, len); IRDA_DEBUG(4, "%s(), len=%d\n", __FUNCTION__, len);
if (msg->msg_flags & ~MSG_DONTWAIT) if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT))
return -EINVAL; return -EINVAL;
if (sk->sk_shutdown & SEND_SHUTDOWN) { if (sk->sk_shutdown & SEND_SHUTDOWN) {
......
...@@ -2726,7 +2726,7 @@ static int pfkey_recvmsg(struct kiocb *kiocb, ...@@ -2726,7 +2726,7 @@ static int pfkey_recvmsg(struct kiocb *kiocb,
int copied, err; int copied, err;
err = -EINVAL; err = -EINVAL;
if (flags & ~(MSG_PEEK|MSG_DONTWAIT|MSG_TRUNC)) if (flags & ~(MSG_PEEK|MSG_DONTWAIT|MSG_TRUNC|MSG_CMSG_COMPAT))
goto out; goto out;
msg->msg_namelen = 0; msg->msg_namelen = 0;
......
...@@ -1021,7 +1021,7 @@ static int nr_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -1021,7 +1021,7 @@ static int nr_sendmsg(struct kiocb *iocb, struct socket *sock,
unsigned char *asmptr; unsigned char *asmptr;
int size; int size;
if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR)) if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT))
return -EINVAL; return -EINVAL;
lock_sock(sk); lock_sock(sk);
......
...@@ -1037,7 +1037,7 @@ static int packet_recvmsg(struct kiocb *iocb, struct socket *sock, ...@@ -1037,7 +1037,7 @@ static int packet_recvmsg(struct kiocb *iocb, struct socket *sock,
int copied, err; int copied, err;
err = -EINVAL; err = -EINVAL;
if (flags & ~(MSG_PEEK|MSG_DONTWAIT|MSG_TRUNC)) if (flags & ~(MSG_PEEK|MSG_DONTWAIT|MSG_TRUNC|MSG_CMSG_COMPAT))
goto out; goto out;
#if 0 #if 0
......
...@@ -1021,7 +1021,7 @@ static int rose_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -1021,7 +1021,7 @@ static int rose_sendmsg(struct kiocb *iocb, struct socket *sock,
unsigned char *asmptr; unsigned char *asmptr;
int n, size, qbit = 0; int n, size, qbit = 0;
if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR)) if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT))
return -EINVAL; return -EINVAL;
if (sk->sk_zapped) if (sk->sk_zapped)
......
...@@ -552,7 +552,7 @@ static int wanpipe_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -552,7 +552,7 @@ static int wanpipe_sendmsg(struct kiocb *iocb, struct socket *sock,
if (sk->sk_state != WANSOCK_CONNECTED) if (sk->sk_state != WANSOCK_CONNECTED)
return -ENOTCONN; return -ENOTCONN;
if (msg->msg_flags&~MSG_DONTWAIT) if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT))
return(-EINVAL); return(-EINVAL);
/* it was <=, now one can send /* it was <=, now one can send
......
...@@ -922,7 +922,7 @@ static int x25_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -922,7 +922,7 @@ static int x25_sendmsg(struct kiocb *iocb, struct socket *sock,
size_t size; size_t size;
int qbit = 0, rc = -EINVAL; int qbit = 0, rc = -EINVAL;
if (msg->msg_flags & ~(MSG_DONTWAIT | MSG_OOB | MSG_EOR)) if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_OOB|MSG_EOR|MSG_CMSG_COMPAT))
goto out; goto out;
/* we currently don't support segmented records at the user interface */ /* we currently don't support segmented records at the user interface */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment