diff options
-rw-r--r-- | net/tipc/core.h | 12 | ||||
-rw-r--r-- | net/tipc/link.c | 6 |
2 files changed, 18 insertions, 0 deletions
diff --git a/net/tipc/core.h b/net/tipc/core.h index b3c9df385bbc..325404fd4eb5 100644 --- a/net/tipc/core.h +++ b/net/tipc/core.h | |||
@@ -337,4 +337,16 @@ static inline void buf_discard(struct sk_buff *skb) | |||
337 | kfree_skb(skb); | 337 | kfree_skb(skb); |
338 | } | 338 | } |
339 | 339 | ||
340 | /** | ||
341 | * buf_linearize - convert a TIPC message buffer into a single contiguous piece | ||
342 | * @skb: message buffer | ||
343 | * | ||
344 | * Returns 0 on success. | ||
345 | */ | ||
346 | |||
347 | static inline int buf_linearize(struct sk_buff *skb) | ||
348 | { | ||
349 | return skb_linearize(skb); | ||
350 | } | ||
351 | |||
340 | #endif | 352 | #endif |
diff --git a/net/tipc/link.c b/net/tipc/link.c index a42f43430101..087379366d3c 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c | |||
@@ -1811,6 +1811,12 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr) | |||
1811 | #endif | 1811 | #endif |
1812 | msg_dbg(msg,"<REC<"); | 1812 | msg_dbg(msg,"<REC<"); |
1813 | 1813 | ||
1814 | /* Ensure message data is a single contiguous unit */ | ||
1815 | |||
1816 | if (unlikely(buf_linearize(buf))) { | ||
1817 | goto cont; | ||
1818 | } | ||
1819 | |||
1814 | if (unlikely(msg_non_seq(msg))) { | 1820 | if (unlikely(msg_non_seq(msg))) { |
1815 | link_recv_non_seq(buf); | 1821 | link_recv_non_seq(buf); |
1816 | continue; | 1822 | continue; |