From: simo.ghannam@gmail.com Subject: [PATCH] tcp/dccp: CVE-2017-8824: use-after-free in DCCP code Date: Mon, 4 Dec 2017 21:27:08 +0100 Message-ID: <5a25afc4.919bdf0a.c917c.b05a@mx.google.com> Cc: Mohamed Ghannam To: netdev@vger.kernel.org Return-path: Received: from mail-wr0-f193.google.com ([209.85.128.193]:37237 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751205AbdLDU1t (ORCPT ); Mon, 4 Dec 2017 15:27:49 -0500 Received: by mail-wr0-f193.google.com with SMTP id k61so18719943wrc.4 for ; Mon, 04 Dec 2017 12:27:49 -0800 (PST) Sender: netdev-owner@vger.kernel.org List-ID: From: Mohamed Ghannam Whenever the sock object is in DCCP_CLOSED state, dccp_disconnect() must free dccps_hc_tx_ccid and dccps_hc_rx_ccid and set to NULL. Signed-off-by: Mohamed Ghannam --- net/dccp/proto.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/dccp/proto.c b/net/dccp/proto.c index b68168f..1814584 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c @@ -259,6 +259,7 @@ int dccp_disconnect(struct sock *sk, int flags) { struct inet_connection_sock *icsk = inet_csk(sk); struct inet_sock *inet = inet_sk(sk); + struct dccp_sock *dp = dccp_sk(sk); int err = 0; const int old_state = sk->sk_state; @@ -279,6 +280,9 @@ int dccp_disconnect(struct sock *sk, int flags) dccp_clear_xmit_timers(sk); + ccid_hc_rx_delete(dp->dccps_hc_rx_ccid, sk); + ccid_hc_tx_delete(dp->dccps_hc_tx_ccid, sk); + dp->dccps_hc_rx_ccid = dp->dccps_hc_tx_ccid = NULL; __skb_queue_purge(&sk->sk_receive_queue); __skb_queue_purge(&sk->sk_write_queue); if (sk->sk_send_head != NULL) { -- 2.7.4