[ovs-dev] [PATCH v3 5/5] classifier: fix conj_set use-after-free issue

Linhaifeng haifeng.lin at huawei.com
Tue Jun 2 09:27:44 UTC 2020


use ovsrcu_set first then use ovsrcu_postpone

CC: Ben Pfaff <blp at nicira.com>
Fixes: 18080541d276 (\classifier: Add support for conjunctive matches.\)

Acked-by: Yanqin Wei <Yanqin.Wei at arm.com>
Signed-off-by: Linhaifeng <haifeng.lin at huawei.com>
---
 lib/classifier.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/classifier.c b/lib/classifier.c
index f2c3497c2..6bff76e07 100644
--- a/lib/classifier.c
+++ b/lib/classifier.c
@@ -249,11 +249,11 @@ cls_rule_set_conjunctions(struct cls_rule *cr,
     unsigned int old_n = old ? old->n : 0;
 
     if (old_n != n || (n && memcmp(old_conj, conj, n * sizeof *conj))) {
+        ovsrcu_set(&match->conj_set,
+                   cls_conjunction_set_alloc(match, conj, n));
         if (old) {
             ovsrcu_postpone(free, old);
         }
-        ovsrcu_set(&match->conj_set,
-                   cls_conjunction_set_alloc(match, conj, n));
     }
 }
 
-- 
2.21.0.windows.1


More information about the dev mailing list