0021-dccp-CVE-2017-8824-use-after-free-in-DCCP-code.patch 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Mohamed Ghannam <[email protected]>
  3. Date: Fri, 8 Dec 2017 15:39:50 +0100
  4. Subject: [PATCH] dccp: CVE-2017-8824: use-after-free in DCCP code
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. Whenever the sock object is in DCCP_CLOSED state,
  9. dccp_disconnect() must free dccps_hc_tx_ccid and
  10. dccps_hc_rx_ccid and set to NULL.
  11. Signed-off-by: Mohamed Ghannam <[email protected]>
  12. Reviewed-by: Eric Dumazet <[email protected]>
  13. Signed-off-by: David S. Miller <[email protected]>
  14. CVE-2017-8824
  15. (cherry picked from commit 69c64866ce072dea1d1e59a0d61e0f66c0dffb76 linux-next)
  16. Signed-off-by: Kleber Sacilotto de Souza <[email protected]>
  17. Acked-by: Seth Forshee <[email protected]>
  18. Acked-by: Colin Ian King <[email protected]>
  19. Signed-off-by: Thadeu Lima de Souza Cascardo <[email protected]>
  20. Signed-off-by: Fabian Grünbichler <[email protected]>
  21. ---
  22. net/dccp/proto.c | 5 +++++
  23. 1 file changed, 5 insertions(+)
  24. diff --git a/net/dccp/proto.c b/net/dccp/proto.c
  25. index b68168fcc06a..9d43c1f40274 100644
  26. --- a/net/dccp/proto.c
  27. +++ b/net/dccp/proto.c
  28. @@ -259,6 +259,7 @@ int dccp_disconnect(struct sock *sk, int flags)
  29. {
  30. struct inet_connection_sock *icsk = inet_csk(sk);
  31. struct inet_sock *inet = inet_sk(sk);
  32. + struct dccp_sock *dp = dccp_sk(sk);
  33. int err = 0;
  34. const int old_state = sk->sk_state;
  35. @@ -278,6 +279,10 @@ int dccp_disconnect(struct sock *sk, int flags)
  36. sk->sk_err = ECONNRESET;
  37. dccp_clear_xmit_timers(sk);
  38. + ccid_hc_rx_delete(dp->dccps_hc_rx_ccid, sk);
  39. + ccid_hc_tx_delete(dp->dccps_hc_tx_ccid, sk);
  40. + dp->dccps_hc_rx_ccid = NULL;
  41. + dp->dccps_hc_tx_ccid = NULL;
  42. __skb_queue_purge(&sk->sk_receive_queue);
  43. __skb_queue_purge(&sk->sk_write_queue);
  44. --
  45. 2.14.2