[ovs-dev] [PATCH] ofproto-dpif-rid: correct logic error in rid_pool_alloc_id()

Andy Zhou azhou at nicira.com
Fri Sep 26 18:32:17 UTC 2014


I will back port to branch-2.3. Thanks for the reminder.

On Fri, Sep 26, 2014 at 10:46 AM, Ben Pfaff <blp at nicira.com> wrote:
> It looks like this wasn't backported, should it be?
>
> On Wed, Sep 24, 2014 at 02:06:46PM -0700, Andy Zhou wrote:
>> Pushed. Thanks for the fix!
>>
>> On Tue, Sep 23, 2014 at 9:41 PM, Simon Horman
>> <simon.horman at netronome.com> wrote:
>> > When searching through the valid ids an id should
>> > be used if is not found rather than if it is found.
>> >
>> > It appears to me that without this change duplicate recirculation
>> > ids may used in cases where the last recirculation id has
>> > been allocated; selection loops back to the beginning of the pool and;
>> > reaches a recirculation id that is still in use.
>> >
>> > As the number of recirculation ids is currently RECIRC_ID_N_IDS = 1024 this
>> > does not seem beyond the bounds of possibility.
>> >
>> > I have not verified that such a scenario can actually occur.  But it seems
>> > that a likely consequence would be that some packets may be forwarded
>> > incorrectly.
>> >
>> > Signed-off-by: Simon Horman <simon.horman at netronome.com>
>> > ---
>> >  ofproto/ofproto-dpif-rid.c | 2 +-
>> >  1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > diff --git a/ofproto/ofproto-dpif-rid.c b/ofproto/ofproto-dpif-rid.c
>> > index b3d98eb..e75dfc8 100644
>> > --- a/ofproto/ofproto-dpif-rid.c
>> > +++ b/ofproto/ofproto-dpif-rid.c
>> > @@ -157,7 +157,7 @@ rid_pool_alloc_id(struct rid_pool *rids)
>> >      }
>> >
>> >      for(id = rids->base; id < rids->base + rids->n_ids; id++) {
>> > -        if (rid_pool_find(rids, id)) {
>> > +        if (!rid_pool_find(rids, id)) {
>> >              goto found_free_id;
>> >          }
>> >      }
>> > --
>> > 2.0.1
>> >
>> _______________________________________________
>> dev mailing list
>> dev at openvswitch.org
>> http://openvswitch.org/mailman/listinfo/dev



More information about the dev mailing list