summaryrefslogtreecommitdiffstats
path: root/net/ipv4/ip_output.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2012-08-10 02:22:47 +0000
committerDavid S. Miller <davem@davemloft.net>2012-08-10 14:08:57 -0700
commitb5ec8eeac46a99004c26791f70b15d001e970acf (patch)
tree8609d6c3e5e9504e6f084828b9b0f8a9084652e3 /net/ipv4/ip_output.c
parent63d02d157ec4124990258d66517b6c11fd6df0cf (diff)
downloadop-kernel-dev-b5ec8eeac46a99004c26791f70b15d001e970acf.zip
op-kernel-dev-b5ec8eeac46a99004c26791f70b15d001e970acf.tar.gz
ipv4: fix ip_send_skb()
ip_send_skb() can send orphaned skb, so we must pass the net pointer to avoid possible NULL dereference in error path. Bug added by commit 3a7c384ffd57 (ipv4: tcp: unicast_sock should not land outside of TCP stack) Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_output.c')
-rw-r--r--net/ipv4/ip_output.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index ec410e0..147ccc3 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -1366,9 +1366,8 @@ out:
return skb;
}
-int ip_send_skb(struct sk_buff *skb)
+int ip_send_skb(struct net *net, struct sk_buff *skb)
{
- struct net *net = sock_net(skb->sk);
int err;
err = ip_local_out(skb);
@@ -1391,7 +1390,7 @@ int ip_push_pending_frames(struct sock *sk, struct flowi4 *fl4)
return 0;
/* Netfilter gets whole the not fragmented skb. */
- return ip_send_skb(skb);
+ return ip_send_skb(sock_net(sk), skb);
}
/*
OpenPOWER on IntegriCloud