Skip to content

Commit 45c8b7b

Browse files
Jon Paul Maloydavem330
authored andcommitted
tipc: allow non-linear first fragment buffer
The current code for message reassembly is erroneously assuming that the the first arriving fragment buffer always is linear, and then goes ahead resetting the fragment list of that buffer in anticipation of more arriving fragments. However, if the buffer already happens to be non-linear, we will inadvertently drop the already attached fragment list, and later on trig a BUG() in __pskb_pull_tail(). We see this happen when running fragmented TIPC multicast across UDP, something made possible since commit d0f9193 ("tipc: add ip/udp media type") We fix this by not resetting the fragment list when the buffer is non- linear, and by initiatlizing our private fragment list tail pointer to the tail of the existing fragment list. Fixes: commit d0f9193 ("tipc: add ip/udp media type") Signed-off-by: Jon Maloy <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1241365 commit 45c8b7b

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

net/tipc/msg.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf)
121121
{
122122
struct sk_buff *head = *headbuf;
123123
struct sk_buff *frag = *buf;
124-
struct sk_buff *tail;
124+
struct sk_buff *tail = NULL;
125125
struct tipc_msg *msg;
126126
u32 fragid;
127127
int delta;
@@ -141,9 +141,15 @@ int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf)
141141
if (unlikely(skb_unclone(frag, GFP_ATOMIC)))
142142
goto err;
143143
head = *headbuf = frag;
144-
skb_frag_list_init(head);
145-
TIPC_SKB_CB(head)->tail = NULL;
146144
*buf = NULL;
145+
TIPC_SKB_CB(head)->tail = NULL;
146+
if (skb_is_nonlinear(head)) {
147+
skb_walk_frags(head, tail) {
148+
TIPC_SKB_CB(head)->tail = tail;
149+
}
150+
} else {
151+
skb_frag_list_init(head);
152+
}
147153
return 0;
148154
}
149155

0 commit comments

Comments
 (0)