diff mbox series

[ovs-dev,ovs-dev,v6,2/3] ofproto-dpif: fix meter use-after-free

Message ID 20220524142902.511315-2-hepeng.0320@bytedance.com
State Superseded
Headers show
Series [ovs-dev,ovs-dev,v6,1/3] ovs-rcu: add rcu_barrier | expand

Commit Message

Peng He May 24, 2022, 2:29 p.m. UTC
add a rcu_barrier before close_dpif_backer to ensure that
all meters has been freed before id_pool_destory meter's
id-pool.

Signed-off-by: Peng He <hepeng.0320@bytedance.com>
Tested-by: David Marchand <david.marchand@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
---
 ofproto/ofproto-dpif.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

David Marchand May 25, 2022, 11:28 a.m. UTC | #1
Title should be: "ofproto-dpif: Fix meter use-after-free."

On Wed, May 25, 2022 at 3:36 AM Peng He <xnhp0320@gmail.com> wrote:
>
> add a rcu_barrier before close_dpif_backer to ensure that

Add*

> all meters has been freed before id_pool_destory meter's

have*

> id-pool.
>
> Signed-off-by: Peng He <hepeng.0320@bytedance.com>
> Tested-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Eelco Chaudron <echaudro@redhat.com>
> ---
>  ofproto/ofproto-dpif.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
> index 6601f2346..0d0d985f0 100644
> --- a/ofproto/ofproto-dpif.c
> +++ b/ofproto/ofproto-dpif.c
> @@ -1848,6 +1848,8 @@ destruct(struct ofproto *ofproto_, bool del)
>
>      seq_destroy(ofproto->ams_seq);
>
> +    /* Wait for all the meter destroy work to finish */

to finish.*


> +    ovsrcu_barrier();
>      close_dpif_backer(ofproto->backer, del);
>  }
>
> --
> 2.25.1
>

Reviewed-by: David Marchand <david.marchand@redhat.com>
diff mbox series

Patch

diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 6601f2346..0d0d985f0 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -1848,6 +1848,8 @@  destruct(struct ofproto *ofproto_, bool del)
 
     seq_destroy(ofproto->ams_seq);
 
+    /* Wait for all the meter destroy work to finish */
+    ovsrcu_barrier();
     close_dpif_backer(ofproto->backer, del);
 }