Skip to content

Commit

Permalink
[DCCP]: Set socket owner iff packet is not data
Browse files Browse the repository at this point in the history
  
Here is a complimentary insurance policy for those feeling a bit insecure.
You don't have to accept this.  However, if you do, you can't blame me for
it :)
  
> 1) dccp_transmit_skb sets the owner for all packets except data packets.
  
We can actually verify this by looking at pkt_type.
  
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
  • Loading branch information
Herbert Xu authored and Arnaldo Carvalho de Melo committed Nov 1, 2005
1 parent 48918a4 commit edc9e81
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions net/dccp/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,21 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)
switch (dcb->dccpd_type) {
case DCCP_PKT_DATA:
set_ack = 0;
/* fall through */
case DCCP_PKT_DATAACK:
break;

case DCCP_PKT_SYNC:
case DCCP_PKT_SYNCACK:
ackno = dcb->dccpd_seq;
/* fall through */
default:
/*
* Only data packets should come through with skb->sk
* set.
*/
WARN_ON(skb->sk);
skb_set_owner_w(skb, sk);
break;
}

Expand All @@ -71,12 +82,6 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)
skb->h.raw = skb_push(skb, dccp_header_size);
dh = dccp_hdr(skb);

/*
* Only data packets should come through with skb->sk set.
*/
if (!skb->sk)
skb_set_owner_w(skb, sk);

/* Build DCCP header and checksum it. */
memset(dh, 0, dccp_header_size);
dh->dccph_type = dcb->dccpd_type;
Expand Down

0 comments on commit edc9e81

Please sign in to comment.