diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2005-10-16 21:08:46 +1000 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2005-10-20 14:44:29 -0200 |
commit | ffa29347dfbc158d1f47f5925324a6f5713659c1 (patch) | |
tree | 66c0360d21cc842af830b9c7ffd6e924652e7ce3 /net | |
parent | fda0fd6c5b722cc48e904e0daafedca275d332af (diff) | |
download | linux-3.10-ffa29347dfbc158d1f47f5925324a6f5713659c1.tar.gz linux-3.10-ffa29347dfbc158d1f47f5925324a6f5713659c1.tar.bz2 linux-3.10-ffa29347dfbc158d1f47f5925324a6f5713659c1.zip |
[DCCP]: Make dccp_write_xmit always free the packet
icmp_send doesn't use skb->sk at all so even if skb->sk has already
been freed it can't cause crash there (it would've crashed somewhere
else first, e.g., ip_queue_xmit).
I found a double-free on an skb that could explain this though.
dccp_sendmsg and dccp_write_xmit are a little confused as to what
should free the packet when something goes wrong. Sometimes they
both go for the ball and end up in each other's way.
This patch makes dccp_write_xmit always free the packet no matter
what. This makes sense since dccp_transmit_skb which in turn comes
from the fact that ip_queue_xmit always frees the packet.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/dccp/output.c | 3 | ||||
-rw-r--r-- | net/dccp/proto.c | 2 |
2 files changed, 2 insertions, 3 deletions
diff --git a/net/dccp/output.c b/net/dccp/output.c index 946ec2db75d..7006549f705 100644 --- a/net/dccp/output.c +++ b/net/dccp/output.c @@ -241,7 +241,8 @@ int dccp_write_xmit(struct sock *sk, struct sk_buff *skb, long *timeo) err = dccp_transmit_skb(sk, skb); ccid_hc_tx_packet_sent(dp->dccps_hc_tx_ccid, sk, 0, len); - } + } else + kfree_skb(skb); return err; } diff --git a/net/dccp/proto.c b/net/dccp/proto.c index a1cfd0e9e3b..a021c3422f6 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c @@ -402,8 +402,6 @@ int dccp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, * This bug was _quickly_ found & fixed by just looking at an OSTRA * generated callgraph 8) -acme */ - if (rc != 0) - goto out_discard; out_release: release_sock(sk); return rc ? : len; |