Skip to content

Commit 5edabca

Browse files
xairydavem330
authored andcommittedFeb 17, 2017
dccp: fix freeing skb too early for IPV6_RECVPKTINFO
In the current DCCP implementation an skb for a DCCP_PKT_REQUEST packet is forcibly freed via __kfree_skb in dccp_rcv_state_process if dccp_v6_conn_request successfully returns. However, if IPV6_RECVPKTINFO is set on a socket, the address of the skb is saved to ireq->pktopts and the ref count for skb is incremented in dccp_v6_conn_request, so skb is still in use. Nevertheless, it gets freed in dccp_rcv_state_process. Fix by calling consume_skb instead of doing goto discard and therefore calling __kfree_skb. Similar fixes for TCP: fb7e239 [TCP]: skb is unexpectedly freed. 0aea76d tcp: SYN packets are now simply consumed Signed-off-by: Andrey Konovalov <andreyknvl@google.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 785f357 commit 5edabca

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎net/dccp/input.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,8 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
606606
if (inet_csk(sk)->icsk_af_ops->conn_request(sk,
607607
skb) < 0)
608608
return 1;
609-
goto discard;
609+
consume_skb(skb);
610+
return 0;
610611
}
611612
if (dh->dccph_type == DCCP_PKT_RESET)
612613
goto discard;

0 commit comments

Comments
 (0)
Please sign in to comment.