]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[TIPC] Fixed sk_buff panic caused by tipc_link_bundle_buf (REVISED)
authorAllan Stephens <allan.stephens@windriver.com>
Tue, 4 Jul 2006 02:39:36 +0000 (19:39 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 4 Jul 2006 02:39:36 +0000 (19:39 -0700)
The recent change to direct inspection of bundle buffer tailroom did not
account for the possiblity of unrequested tailroom added by skb_alloc(),
thereby allowing a bundle to be created that exceeds the current link MTU.
An additional check now ensures that bundling works correctly no matter
if the bundle buffer is smaller, larger, or equal to the link MTU.

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

index 86f54f3512f1733f746f26547e9d424457ba445b..762aac2572be88f768d6e6d0d2c3337508b7965a 100644 (file)
@@ -297,7 +297,10 @@ static inline struct tipc_msg *buf_msg(struct sk_buff *skb)
  * buf_acquire - creates a TIPC message buffer
  * @size: message size (including TIPC header)
  *
- * Returns a new buffer.  Space is reserved for a data link header.
+ * Returns a new buffer with data pointers set to the specified size.
+ * 
+ * NOTE: Headroom is reserved to allow prepending of a data link header.
+ *       There may also be unrequested tailroom present at the buffer's end.
  */
 
 static inline struct sk_buff *buf_acquire(u32 size)
index c6831c75cfa4dd9ec9c03fb3da7cb451928f7a0c..c10e18a49b96b99d56fb8a71900ced7bebf98da6 100644 (file)
@@ -998,6 +998,8 @@ static int link_bundle_buf(struct link *l_ptr,
                return 0;
        if (skb_tailroom(bundler) < (pad + size))
                return 0;
+       if (link_max_pkt(l_ptr) < (to_pos + size))
+               return 0;
 
        skb_put(bundler, pad + size);
        memcpy(bundler->data + to_pos, buf->data, size);