commit 8276ea30400887cb25186571ac62252da97b91df Author: Christopher Faulet Date: Fri Apr 19 14:50:55 2019 +0200 BUG/MEDIUM: thread/http: Add missing locks in set-map and add-acl HTTP rules Locks are missing in the rules "http-request set-map" and "http-response add-acl" when an acl or map update is performed. Pattern elements must be locked. This patch must be backported to 1.9 and 1.8. For the 1.8, the HTX part must be ignored. (cherry picked from commit e84289e5854aa3b00cd19032387f435ca6748491) Signed-off-by: Christopher Faulet (cherry picked from commit 82dedc4add923bd1ff1b47a559a23e83886521a8) Signed-off-by: Christopher Faulet diff --git a/src/proto_http.c b/src/proto_http.c index 9beaa137..ccacd6a4 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -2717,12 +2717,14 @@ resume_execution: value->str[value->len] = '\0'; /* perform update */ + HA_SPIN_LOCK(PATREF_LOCK, &ref->lock); if (pat_ref_find_elt(ref, key->str) != NULL) /* update entry if it exists */ pat_ref_set(ref, key->str, value->str, NULL); else /* insert a new entry */ pat_ref_add(ref, key->str, value->str, NULL); + HA_SPIN_UNLOCK(PATREF_LOCK, &ref->lock); free_trash_chunk(key); free_trash_chunk(value); @@ -2978,8 +2980,10 @@ resume_execution: /* perform update */ /* check if the entry already exists */ + HA_SPIN_LOCK(PATREF_LOCK, &ref->lock); if (pat_ref_find_elt(ref, key->str) == NULL) pat_ref_add(ref, key->str, NULL, NULL); + HA_SPIN_UNLOCK(PATREF_LOCK, &ref->lock); free_trash_chunk(key); break;