Commit 863fae66 authored by Allan Stephens's avatar Allan Stephens Committed by David S. Miller

[TIPC] Fixed sk_buff panic caused by tipc_link_bundle_buf (REVISED)

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: default avatarAllan Stephens <allan.stephens@windriver.com>
Signed-off-by: default avatarPer Liden <per.liden@ericsson.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bbcf467d
...@@ -297,7 +297,10 @@ static inline struct tipc_msg *buf_msg(struct sk_buff *skb) ...@@ -297,7 +297,10 @@ static inline struct tipc_msg *buf_msg(struct sk_buff *skb)
* buf_acquire - creates a TIPC message buffer * buf_acquire - creates a TIPC message buffer
* @size: message size (including TIPC header) * @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) static inline struct sk_buff *buf_acquire(u32 size)
......
...@@ -998,6 +998,8 @@ static int link_bundle_buf(struct link *l_ptr, ...@@ -998,6 +998,8 @@ static int link_bundle_buf(struct link *l_ptr,
return 0; return 0;
if (skb_tailroom(bundler) < (pad + size)) if (skb_tailroom(bundler) < (pad + size))
return 0; return 0;
if (link_max_pkt(l_ptr) < (to_pos + size))
return 0;
skb_put(bundler, pad + size); skb_put(bundler, pad + size);
memcpy(bundler->data + to_pos, buf->data, size); memcpy(bundler->data + to_pos, buf->data, size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment