summaryrefslogtreecommitdiff
path: root/net/dccp
diff options
context:
space:
mode:
authorMohamed Ghannam <simo.ghannam@gmail.com>2017-12-05 20:58:35 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-02-17 13:21:13 +0100
commit7e2fb808d3c7c52f88ebc670949dbf1bae48f2a2 (patch)
treefc3f1cf583fc3866c18dba04b226b7fab49d09c9 /net/dccp
parenta384e5437f705972d2884cea17b931c1a2cd3277 (diff)
dccp: CVE-2017-8824: use-after-free in DCCP code
commit 69c64866ce072dea1d1e59a0d61e0f66c0dffb76 upstream. 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 <simo.ghannam@gmail.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/dccp')
-rw-r--r--net/dccp/proto.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index b68168fcc06a..9d43c1f40274 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;
@@ -278,6 +279,10 @@ int dccp_disconnect(struct sock *sk, int flags)
sk->sk_err = ECONNRESET;
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 = NULL;
+ dp->dccps_hc_tx_ccid = NULL;
__skb_queue_purge(&sk->sk_receive_queue);
__skb_queue_purge(&sk->sk_write_queue);