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.

52 lines
1.7 KiB

  1. From 294c8d2f81847e0e2d26aa0700564ac2f6aaffa6 Mon Sep 17 00:00:00 2001
  2. From: Thierry Fournier <thierry.fournier@ozon.io>
  3. Date: Mon, 6 Jun 2016 18:28:05 +0200
  4. Subject: [PATCH 3/4] BUG/MEDIUM: sticktables: segfault in some configuration
  5. error cases
  6. When a stick table is tracked, and another one is used later on the
  7. configuration, a segfault occurs.
  8. The function "smp_create_src_stkctr" can return a NULL value, and
  9. its value is not tested, so one other function try to dereference
  10. a NULL pointer. This patch just add a verification of the NULL
  11. pointer.
  12. The problem is reproduced with this configuration:
  13. listen www
  14. mode http
  15. bind :12345
  16. tcp-request content track-sc0 src table IPv4
  17. http-request allow if { sc0_inc_gpc0(IPv6) gt 0 }
  18. server dummy 127.0.0.1:80
  19. backend IPv4
  20. stick-table type ip size 10 expire 60s store gpc0
  21. backend IPv6
  22. stick-table type ipv6 size 10 expire 60s store gpc0
  23. Thank to kabefuna@gmail.com for the bug report.
  24. This patch must be backported in the 1.6 and 1.5 version.
  25. (cherry picked from commit 6fc340ff07171bb85d11d835fa4158bbdef240a0)
  26. (cherry picked from commit 4693e2302271252044038c9be38487fb16218e5b)
  27. ---
  28. src/session.c | 2 +-
  29. 1 file changed, 1 insertion(+), 1 deletion(-)
  30. diff --git a/src/session.c b/src/session.c
  31. index 4e84803..fbd5094 100644
  32. --- a/src/session.c
  33. +++ b/src/session.c
  34. @@ -2908,7 +2908,7 @@ smp_fetch_sc_inc_gpc0(struct proxy *px, struct session *l4, void *l7, unsigned i
  35. smp->flags = SMP_F_VOL_TEST;
  36. smp->type = SMP_T_UINT;
  37. smp->data.uint = 0;
  38. - if (stkctr_entry(stkctr) != NULL) {
  39. + if (stkctr && stkctr_entry(stkctr)) {
  40. void *ptr;
  41. /* First, update gpc0_rate if it's tracked. Second, update its
  42. --
  43. 2.7.3