Skip to content

Commit

Permalink
tipc: fix dereference before check warning
Browse files Browse the repository at this point in the history
This fixes the following Smatch warning:
net/tipc/link.c:2364 tipc_link_recv_fragment()
    warn: variable dereferenced before check '*head' (see line 2361)

A null pointer might be passed to skb_try_coalesce if
a malicious sender injects orphan fragments on a link.

Signed-off-by: Erik Hugne <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Erik Hugne authored and davem330 committed Nov 15, 2013
1 parent c9e9042 commit 3db0a19
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/tipc/link.c
Original file line number Diff line number Diff line change
Expand Up @@ -2358,7 +2358,8 @@ int tipc_link_recv_fragment(struct sk_buff **head, struct sk_buff **tail,
*head = frag;
skb_frag_list_init(*head);
return 0;
} else if (skb_try_coalesce(*head, frag, &headstolen, &delta)) {
} else if (*head &&
skb_try_coalesce(*head, frag, &headstolen, &delta)) {
kfree_skb_partial(frag, headstolen);
} else {
if (!*head)
Expand Down

0 comments on commit 3db0a19

Please sign in to comment.