@@ -1047,61 +1047,6 @@ static void link_retrieve_defq(struct tipc_link *link,
10471047 skb_queue_splice_tail_init (& link -> deferred_queue , list );
10481048}
10491049
1050- /**
1051- * link_recv_buf_validate - validate basic format of received message
1052- *
1053- * This routine ensures a TIPC message has an acceptable header, and at least
1054- * as much data as the header indicates it should. The routine also ensures
1055- * that the entire message header is stored in the main fragment of the message
1056- * buffer, to simplify future access to message header fields.
1057- *
1058- * Note: Having extra info present in the message header or data areas is OK.
1059- * TIPC will ignore the excess, under the assumption that it is optional info
1060- * introduced by a later release of the protocol.
1061- */
1062- static int link_recv_buf_validate (struct sk_buff * buf )
1063- {
1064- static u32 min_data_hdr_size [8 ] = {
1065- SHORT_H_SIZE , MCAST_H_SIZE , NAMED_H_SIZE , BASIC_H_SIZE ,
1066- MAX_H_SIZE , MAX_H_SIZE , MAX_H_SIZE , MAX_H_SIZE
1067- };
1068-
1069- struct tipc_msg * msg ;
1070- u32 tipc_hdr [2 ];
1071- u32 size ;
1072- u32 hdr_size ;
1073- u32 min_hdr_size ;
1074-
1075- /* If this packet comes from the defer queue, the skb has already
1076- * been validated
1077- */
1078- if (unlikely (TIPC_SKB_CB (buf )-> deferred ))
1079- return 1 ;
1080-
1081- if (unlikely (buf -> len < MIN_H_SIZE ))
1082- return 0 ;
1083-
1084- msg = skb_header_pointer (buf , 0 , sizeof (tipc_hdr ), tipc_hdr );
1085- if (msg == NULL )
1086- return 0 ;
1087-
1088- if (unlikely (msg_version (msg ) != TIPC_VERSION ))
1089- return 0 ;
1090-
1091- size = msg_size (msg );
1092- hdr_size = msg_hdr_sz (msg );
1093- min_hdr_size = msg_isdata (msg ) ?
1094- min_data_hdr_size [msg_type (msg )] : INT_H_SIZE ;
1095-
1096- if (unlikely ((hdr_size < min_hdr_size ) ||
1097- (size < hdr_size ) ||
1098- (buf -> len < size ) ||
1099- (size - hdr_size > TIPC_MAX_USER_MSG_SIZE )))
1100- return 0 ;
1101-
1102- return pskb_may_pull (buf , hdr_size );
1103- }
1104-
11051050/**
11061051 * tipc_rcv - process TIPC packets/messages arriving from off-node
11071052 * @net: the applicable net namespace
@@ -1127,7 +1072,7 @@ void tipc_rcv(struct net *net, struct sk_buff *skb, struct tipc_bearer *b_ptr)
11271072
11281073 while ((skb = __skb_dequeue (& head ))) {
11291074 /* Ensure message is well-formed */
1130- if (unlikely (!link_recv_buf_validate (skb )))
1075+ if (unlikely (!tipc_msg_validate (skb )))
11311076 goto discard ;
11321077
11331078 /* Ensure message data is a single contiguous unit */
@@ -1398,7 +1343,6 @@ static void link_handle_out_of_seq_msg(struct tipc_link *l_ptr,
13981343
13991344 if (tipc_link_defer_pkt (& l_ptr -> deferred_queue , buf )) {
14001345 l_ptr -> stats .deferred_recv ++ ;
1401- TIPC_SKB_CB (buf )-> deferred = true;
14021346 if ((skb_queue_len (& l_ptr -> deferred_queue ) % 16 ) == 1 )
14031347 tipc_link_proto_xmit (l_ptr , STATE_MSG , 0 , 0 , 0 , 0 , 0 );
14041348 } else {
0 commit comments