From: Allan Stephens Date: Thu, 26 Apr 2012 22:13:08 +0000 (-0400) Subject: tipc: Reject payload messages with invalid message type X-Git-Tag: next-20120503~56^2~23^2~1 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=aad585473fe1e4b07f2ec1e2432475937f90c385;p=karo-tx-linux.git tipc: Reject payload messages with invalid message type Adds check to ensure TIPC sockets reject incoming payload messages that have an unrecognized message type. Remove the old open question about whether TIPC_ERR_NO_PORT is the proper return value. It is appropriate here since there are valid instances where another node can make use of the reply, and at this point in time the host is already broadcasting TIPC data, so there are no real security concerns. Signed-off-by: Allan Stephens Signed-off-by: Paul Gortmaker --- diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 6d4991e8f670..3c00b40f815f 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -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))