Skip to content

Commit 3db0a19

Browse files
Erik Hugnedavem330
authored andcommitted
tipc: fix dereference before check warning
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 <erik.hugne@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent c9e9042 commit 3db0a19

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/tipc/link.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2358,7 +2358,8 @@ int tipc_link_recv_fragment(struct sk_buff **head, struct sk_buff **tail,
23582358
*head = frag;
23592359
skb_frag_list_init(*head);
23602360
return 0;
2361-
} else if (skb_try_coalesce(*head, frag, &headstolen, &delta)) {
2361+
} else if (*head &&
2362+
skb_try_coalesce(*head, frag, &headstolen, &delta)) {
23622363
kfree_skb_partial(frag, headstolen);
23632364
} else {
23642365
if (!*head)

0 commit comments

Comments
 (0)