[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openvswitch-dev
Subject:    [ovs-dev] [PATCH] ofproto-dpif: Close race between processing packet_ins and checking seqno.
From:       blp () nicira ! com (Ben Pfaff)
Date:       2014-04-30 20:37:09
Message-ID: 20140430203709.GA10569 () nicira ! com
[Download RAW message or body]

Applied to master, branch-2.2, branch-2.1.  Thanks!

On Wed, Apr 30, 2014 at 11:19:22AM -0700, Alex Wang wrote:
> Thanks Ben for spotting and fixing this,
> 
> Acked-by: Alex Wang <alexw at nicira.com>
> 
> 
> On Wed, Apr 30, 2014 at 11:08 AM, Ben Pfaff <blp at nicira.com> wrote:
> 
> > If a packet-in were to be queued, and the sequence number changed, after
> > grabbing the list of packet-ins, then the existing code could have gone to
> > sleep until something happened.  By grabbing the sequence number before
> > the list of packet-ins, we avoid this race.
> >
> > Found by inspection.
> >
> > Signed-off-by: Ben Pfaff <blp at nicira.com>
> > ---
> >  ofproto/ofproto-dpif.c |   12 ++++++------
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
> > index 4cebd77..5eea5ab 100644
> > --- a/ofproto/ofproto-dpif.c
> > +++ b/ofproto/ofproto-dpif.c
> > @@ -1357,6 +1357,12 @@ run(struct ofproto *ofproto_)
> >          ovs_rwlock_unlock(&ofproto->ml->rwlock);
> >      }
> >
> > +    /* Always updates the ofproto->pins_seqno to avoid frequent wakeup
> > during
> > +     * flow restore.  Even though nothing is processed during flow
> > restore,
> > +     * all queued 'pins' will be handled immediately when flow restore
> > +     * completes. */
> > +    ofproto->pins_seqno = seq_read(ofproto->pins_seq);
> > +
> >      /* Do not perform any periodic activity required by 'ofproto' while
> >       * waiting for flow restore to complete. */
> >      if (!ofproto_get_flow_restore_wait()) {
> > @@ -1372,12 +1378,6 @@ run(struct ofproto *ofproto_)
> >          }
> >      }
> >
> > -    /* Always updates the ofproto->pins_seqno to avoid frequent wakeup
> > during
> > -     * flow restore.  Even though nothing is processed during flow
> > restore,
> > -     * all queued 'pins' will be handled immediately when flow restore
> > -     * completes. */
> > -    ofproto->pins_seqno = seq_read(ofproto->pins_seq);
> > -
> >      if (ofproto->netflow) {
> >          netflow_run(ofproto->netflow);
> >      }
> > --
> > 1.7.10.4
> >
> > _______________________________________________
> > dev mailing list
> > dev at openvswitch.org
> > http://openvswitch.org/mailman/listinfo/dev
> >

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic