]> err.no Git - linux-2.6/commitdiff
[TIPC]: Force linearization of non-linear sk_buffs
authorAllan Stephens <allan.stephens@windriver.com>
Wed, 16 Apr 2008 02:03:23 +0000 (19:03 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 16 Apr 2008 02:03:23 +0000 (19:03 -0700)
This patch allows TIPC to process incoming messages that are
stored in a fragmented sk_buff, by forcing the linearization
of any such messages it receives.

Note: This is an interim solution to allow TIPC to operate with
Ethernet devices that generate non-linear buffers (such as the
gianfar driver), until such time as the rest of TIPC is enhanced
to handle sk_buffs with multiple data areas.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/core.h
net/tipc/link.c

index b3c9df385bbcf47f88d2eb991f2bf004d034d19f..325404fd4eb5efaebe86109333b9ebc715593762 100644 (file)
@@ -337,4 +337,16 @@ static inline void buf_discard(struct sk_buff *skb)
        kfree_skb(skb);
 }
 
+/**
+ * buf_linearize - convert a TIPC message buffer into a single contiguous piece
+ * @skb: message buffer
+ *
+ * Returns 0 on success.
+ */
+
+static inline int buf_linearize(struct sk_buff *skb)
+{
+       return skb_linearize(skb);
+}
+
 #endif
index a42f4343010118d0e05736a715412b5b7f663f6b..087379366d3c8aba1519104424fe3ba3b5623a9b 100644 (file)
@@ -1811,6 +1811,12 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr)
 #endif
                        msg_dbg(msg,"<REC<");
 
+               /* Ensure message data is a single contiguous unit */
+
+               if (unlikely(buf_linearize(buf))) {
+                       goto cont;
+               }
+
                if (unlikely(msg_non_seq(msg))) {
                        link_recv_non_seq(buf);
                        continue;