]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[DCCP]: Make dccp_write_xmit always free the packet
authorHerbert Xu <herbert@gondor.apana.org.au>
Sun, 16 Oct 2005 11:08:46 +0000 (21:08 +1000)
committerArnaldo Carvalho de Melo <acme@mandriva.com>
Thu, 20 Oct 2005 16:44:29 +0000 (14:44 -0200)
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>
net/dccp/output.c
net/dccp/proto.c

index 946ec2db75de74a1170657e7e5f5f591ec35ce4a..7006549f70504433abca2d0a1f55009bfe6e5ad3 100644 (file)
@@ -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;
 }
index a1cfd0e9e3bc922ff3e670d49b8412c26f0c5d62..a021c3422f6773d3d5643e9b7e9ccdc475511951 100644 (file)
@@ -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;