netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tipc: fix dereference before check warning
@ 2013-11-13  8:35 erik.hugne
  2013-11-14  8:15 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: erik.hugne @ 2013-11-13  8:35 UTC (permalink / raw)
  To: jon.maloy, paul.gortmaker, dan.carpenter, maloy, netdev
  Cc: tipc-discussion, ying.xue, Erik Hugne

From: Erik Hugne <erik.hugne@ericsson.com>

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>
---
 net/tipc/link.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/tipc/link.c b/net/tipc/link.c
index cf465d6..69cd9bf 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -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)
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tipc: fix dereference before check warning
  2013-11-13  8:35 [PATCH] tipc: fix dereference before check warning erik.hugne
@ 2013-11-14  8:15 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-11-14  8:15 UTC (permalink / raw)
  To: erik.hugne
  Cc: jon.maloy, paul.gortmaker, dan.carpenter, maloy, netdev,
	tipc-discussion, ying.xue

From: <erik.hugne@ericsson.com>
Date: Wed, 13 Nov 2013 09:35:11 +0100

> From: Erik Hugne <erik.hugne@ericsson.com>
> 
> 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>

Applied, thank you.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-11-14  8:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-13  8:35 [PATCH] tipc: fix dereference before check warning erik.hugne
2013-11-14  8:15 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).