You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.2 KiB

  1. commit d9a130e1962c2a5352f33088c563f4248a102c48
  2. Author: Willy Tarreau <w@1wt.eu>
  3. Date: Fri Aug 24 15:48:59 2018 +0200
  4. BUG/MEDIUM: mux_pt: dereference the connection with care in mux_pt_wake()
  5. mux_pt_wake() calls data->wake() which can return -1 indicating that the
  6. connection was just destroyed. We need to check for this condition and
  7. immediately exit in this case otherwise we dereference a just freed
  8. connection. Note that this mainly happens on idle connections between
  9. two HTTP requests. It can have random implications between requests as
  10. it may lead a wrong connection's polling to be re-enabled or disabled
  11. for example, especially with threads.
  12. This patch must be backported to 1.8.
  13. (cherry picked from commit ad7f0ad1c3c9c541a4c315b24d4500405d1383ee)
  14. Signed-off-by: Willy Tarreau <w@1wt.eu>
  15. diff --git a/src/mux_pt.c b/src/mux_pt.c
  16. index a68b9621..c43e30f2 100644
  17. --- a/src/mux_pt.c
  18. +++ b/src/mux_pt.c
  19. @@ -51,6 +51,9 @@ static int mux_pt_wake(struct connection *conn)
  20. ret = cs->data_cb->wake ? cs->data_cb->wake(cs) : 0;
  21. + if (ret < 0)
  22. + return ret;
  23. +
  24. /* If we had early data, and we're done with the handshake
  25. * then whe know the data are safe, and we can remove the flag.
  26. */