diff mbox series

[ovs-dev,v3,4/5] ofproto: fix actions use-after-free issue

Message ID 4099DE2E54AFAD489356C6C9161D53339735B56F@dggeml522-mbs.china.huawei.com
State Superseded
Headers show
Series [ovs-dev,v3,1/5] ovs-rcu: fix rcu use-after-free issue | expand

Commit Message

Linhaifeng June 2, 2020, 9:27 a.m. UTC
use ovsrcu_set first then use ovsrcu_postpone

CC: Eelco Chaudron <echaudro@redhat.com>
Fixes: f82b3b6a2f4d (\ofproto-dpif-upcall: Only call ovsrcu_postpone()
on active actions\)

Acked-by: Yanqin Wei <Yanqin.Wei@arm.com>
Signed-off-by: Linhaifeng <haifeng.lin@huawei.com>
---
 ofproto/ofproto-dpif-upcall.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c
index 5e08ef10d..be6dafb78 100644
--- a/ofproto/ofproto-dpif-upcall.c
+++ b/ofproto/ofproto-dpif-upcall.c
@@ -1658,11 +1658,10 @@  ukey_set_actions(struct udpif_key *ukey, const struct ofpbuf *actions)
     struct ofpbuf *old_actions = ovsrcu_get_protected(struct ofpbuf *,
                                                       &ukey->actions);
 
+    ovsrcu_set(&ukey->actions, ofpbuf_clone(actions));
     if (old_actions) {
         ovsrcu_postpone(ofpbuf_delete, old_actions);
     }
-
-    ovsrcu_set(&ukey->actions, ofpbuf_clone(actions));
 }
 
 static struct udpif_key *