From 4d8eb9bdfbfa7a4f8a3370ad51c0efae507d10d3 Mon Sep 17 00:00:00 2001 From: Thomas Graf Date: Mon, 3 Sep 2012 04:27:42 +0000 Subject: [PATCH] --- yaml --- r: 322734 b: refs/heads/master c: 4c3a5bdae293f75cdf729c6c00124e8489af2276 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/net/sctp/output.c | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index c2562d98ee5c..9d0bb77db843 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e812347ccf9e8ce073b0ba0c49d03b124707b2b4 +refs/heads/master: 4c3a5bdae293f75cdf729c6c00124e8489af2276 diff --git a/trunk/net/sctp/output.c b/trunk/net/sctp/output.c index 838e18b4d7ea..be50aa234dcd 100644 --- a/trunk/net/sctp/output.c +++ b/trunk/net/sctp/output.c @@ -364,6 +364,25 @@ sctp_xmit_t sctp_packet_append_chunk(struct sctp_packet *packet, return retval; } +static void sctp_packet_release_owner(struct sk_buff *skb) +{ + sk_free(skb->sk); +} + +static void sctp_packet_set_owner_w(struct sk_buff *skb, struct sock *sk) +{ + skb_orphan(skb); + skb->sk = sk; + skb->destructor = sctp_packet_release_owner; + + /* + * The data chunks have already been accounted for in sctp_sendmsg(), + * therefore only reserve a single byte to keep socket around until + * the packet has been transmitted. + */ + atomic_inc(&sk->sk_wmem_alloc); +} + /* All packets are sent to the network through this function from * sctp_outq_tail(). * @@ -405,7 +424,7 @@ int sctp_packet_transmit(struct sctp_packet *packet) /* Set the owning socket so that we know where to get the * destination IP address. */ - skb_set_owner_w(nskb, sk); + sctp_packet_set_owner_w(nskb, sk); if (!sctp_transport_dst_check(tp)) { sctp_transport_route(tp, NULL, sctp_sk(sk));