Skip to content

Commit b77ee46

Browse files
xairyniclimcy
authored andcommitted
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. 0aea76d35c9651d55bbaf746e7914e5f9ae5a25d tcp: SYN packets are now simply consumed Change-Id: I8fb66546ff3870ad05030ea4e963b5cb3e015bbe Signed-off-by: Andrey Konovalov <[email protected]> Acked-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 06cd520 commit b77ee46

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)