55ccfa6c25b03d90b279b6b864c49d848ad60dd2
[openwrt-packages.git] /
1 commit 8276ea30400887cb25186571ac62252da97b91df
2 Author: Christopher Faulet <cfaulet@haproxy.com>
3 Date:   Fri Apr 19 14:50:55 2019 +0200
4
5     BUG/MEDIUM: thread/http: Add missing locks in set-map and add-acl HTTP rules
6     
7     Locks are missing in the rules "http-request set-map" and "http-response
8     add-acl" when an acl or map update is performed. Pattern elements must be
9     locked.
10     
11     This patch must be backported to 1.9 and 1.8. For the 1.8, the HTX part must be
12     ignored.
13     
14     (cherry picked from commit e84289e5854aa3b00cd19032387f435ca6748491)
15     Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
16     (cherry picked from commit 82dedc4add923bd1ff1b47a559a23e83886521a8)
17     Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
18
19 diff --git a/src/proto_http.c b/src/proto_http.c
20 index 9beaa137..ccacd6a4 100644
21 --- a/src/proto_http.c
22 +++ b/src/proto_http.c
23 @@ -2717,12 +2717,14 @@ resume_execution:
24                         value->str[value->len] = '\0';
25  
26                         /* perform update */
27 +                       HA_SPIN_LOCK(PATREF_LOCK, &ref->lock);
28                         if (pat_ref_find_elt(ref, key->str) != NULL)
29                                 /* update entry if it exists */
30                                 pat_ref_set(ref, key->str, value->str, NULL);
31                         else
32                                 /* insert a new entry */
33                                 pat_ref_add(ref, key->str, value->str, NULL);
34 +                       HA_SPIN_UNLOCK(PATREF_LOCK, &ref->lock);
35  
36                         free_trash_chunk(key);
37                         free_trash_chunk(value);
38 @@ -2978,8 +2980,10 @@ resume_execution:
39  
40                         /* perform update */
41                         /* check if the entry already exists */
42 +                       HA_SPIN_LOCK(PATREF_LOCK, &ref->lock);
43                         if (pat_ref_find_elt(ref, key->str) == NULL)
44                                 pat_ref_add(ref, key->str, NULL, NULL);
45 +                       HA_SPIN_UNLOCK(PATREF_LOCK, &ref->lock);
46  
47                         free_trash_chunk(key);
48                         break;
git clone https://git.99rst.org/PROJECT