]> Pileus Git - ~andy/linux/blobdiff - net/tipc/socket.c
tipc: Reject payload messages with invalid message type
[~andy/linux] / net / tipc / socket.c
index 6d4991e8f6701845b3f81d8269505aadf0f8020c..3c00b40f815fc256048829217bf0624005bbf697 100644 (file)
@@ -1223,11 +1223,8 @@ static u32 filter_rcv(struct sock *sk, struct sk_buff *buf)
 
        /* Reject message if it is wrong sort of message for socket */
 
-       /*
-        * WOULD IT BE BETTER TO JUST DISCARD THESE MESSAGES INSTEAD?
-        * "NO PORT" ISN'T REALLY THE RIGHT ERROR CODE, AND THERE MAY
-        * BE SECURITY IMPLICATIONS INHERENT IN REJECTING INVALID TRAFFIC
-        */
+       if (msg_type(msg) > TIPC_DIRECT_MSG)
+               return TIPC_ERR_NO_PORT;
 
        if (sock->state == SS_READY) {
                if (msg_connected(msg))