aboutsummaryrefslogtreecommitdiffstats
path: root/net/phonet
diff options
context:
space:
mode:
authorRémi Denis-Courmont <remi.denis-courmont@nokia.com>2010-01-03 21:02:49 -0500
committerDavid S. Miller <davem@davemloft.net>2010-01-07 03:24:55 -0500
commit82ecbcb9c6b5257929968d5b0ed536772a9b4ac5 (patch)
treec147c743bc284709f87ba677048757a3b4547357 /net/phonet
parentfea93ecef619b5779ca6984568517b1685079b05 (diff)
Phonet: reject unsupported sendmsg/recvmsg flags
Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/phonet')
-rw-r--r--net/phonet/datagram.c6
-rw-r--r--net/phonet/pep.c10
2 files changed, 13 insertions, 3 deletions
diff --git a/net/phonet/datagram.c b/net/phonet/datagram.c
index 67f072e94d00..387197b579b1 100644
--- a/net/phonet/datagram.c
+++ b/net/phonet/datagram.c
@@ -75,7 +75,8 @@ static int pn_sendmsg(struct kiocb *iocb, struct sock *sk,
75 struct sk_buff *skb; 75 struct sk_buff *skb;
76 int err; 76 int err;
77 77
78 if (msg->msg_flags & MSG_OOB) 78 if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_NOSIGNAL|
79 MSG_CMSG_COMPAT))
79 return -EOPNOTSUPP; 80 return -EOPNOTSUPP;
80 81
81 if (msg->msg_name == NULL) 82 if (msg->msg_name == NULL)
@@ -119,7 +120,8 @@ static int pn_recvmsg(struct kiocb *iocb, struct sock *sk,
119 int rval = -EOPNOTSUPP; 120 int rval = -EOPNOTSUPP;
120 int copylen; 121 int copylen;
121 122
122 if (flags & MSG_OOB) 123 if (flags & ~(MSG_PEEK|MSG_TRUNC|MSG_DONTWAIT|MSG_NOSIGNAL|
124 MSG_CMSG_COMPAT))
123 goto out_nofree; 125 goto out_nofree;
124 126
125 if (addr_len) 127 if (addr_len)
diff --git a/net/phonet/pep.c b/net/phonet/pep.c
index 72db27e3fc06..360cf377693e 100644
--- a/net/phonet/pep.c
+++ b/net/phonet/pep.c
@@ -860,7 +860,9 @@ static int pep_sendmsg(struct kiocb *iocb, struct sock *sk,
860 int flags = msg->msg_flags; 860 int flags = msg->msg_flags;
861 int err, done; 861 int err, done;
862 862
863 if (msg->msg_flags & MSG_OOB || !(msg->msg_flags & MSG_EOR)) 863 if ((msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_NOSIGNAL|
864 MSG_CMSG_COMPAT)) ||
865 !(msg->msg_flags & MSG_EOR))
864 return -EOPNOTSUPP; 866 return -EOPNOTSUPP;
865 867
866 skb = sock_alloc_send_skb(sk, MAX_PNPIPE_HEADER + len, 868 skb = sock_alloc_send_skb(sk, MAX_PNPIPE_HEADER + len,
@@ -981,6 +983,10 @@ static int pep_recvmsg(struct kiocb *iocb, struct sock *sk,
981 struct sk_buff *skb; 983 struct sk_buff *skb;
982 int err; 984 int err;
983 985
986 if (flags & ~(MSG_OOB|MSG_PEEK|MSG_TRUNC|MSG_DONTWAIT|MSG_WAITALL|
987 MSG_NOSIGNAL|MSG_CMSG_COMPAT))
988 return -EOPNOTSUPP;
989
984 if (unlikely(1 << sk->sk_state & (TCPF_LISTEN | TCPF_CLOSE))) 990 if (unlikely(1 << sk->sk_state & (TCPF_LISTEN | TCPF_CLOSE)))
985 return -ENOTCONN; 991 return -ENOTCONN;
986 992
@@ -988,6 +994,8 @@ static int pep_recvmsg(struct kiocb *iocb, struct sock *sk,
988 /* Dequeue and acknowledge control request */ 994 /* Dequeue and acknowledge control request */
989 struct pep_sock *pn = pep_sk(sk); 995 struct pep_sock *pn = pep_sk(sk);
990 996
997 if (flags & MSG_PEEK)
998 return -EOPNOTSUPP;
991 skb = skb_dequeue(&pn->ctrlreq_queue); 999 skb = skb_dequeue(&pn->ctrlreq_queue);
992 if (skb) { 1000 if (skb) {
993 pep_ctrlreq_error(sk, skb, PN_PIPE_NO_ERROR, 1001 pep_ctrlreq_error(sk, skb, PN_PIPE_NO_ERROR,