aboutsummaryrefslogtreecommitdiffstats
path: root/net/phonet/pep.c
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/pep.c
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/pep.c')
-rw-r--r--net/phonet/pep.c10
1 files changed, 9 insertions, 1 deletions
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,