[ovs-dev] [PATCH] rconn: Avoid memory leak in rconn_send_with_limit() on queue overflow.

Ben Pfaff blp at nicira.com
Mon Jan 7 23:00:44 UTC 2013


Thanks.  I applied this to master and branch-1.[789].  I take back the
claim about this bug going back farther than that; it only extends to
1.7.

On Mon, Jan 07, 2013 at 02:33:28PM -0800, Ethan Jackson wrote:
> Acked-by: Ethan Jackson <ethan at nicira.com>
> 
> 
> On Fri, Jan 4, 2013 at 1:48 PM, Ben Pfaff <blp at nicira.com> wrote:
> 
> > Bug #14357.
> > Reported-by: Luca Giraudo <lgiraudo at nicira.com>
> > Signed-off-by: Ben Pfaff <blp at nicira.com>
> > ---
> > This leak has been around forever.  I expect to backport it all the
> > way to 1.4.
> >
> >  lib/rconn.c |   11 +++++------
> >  1 files changed, 5 insertions(+), 6 deletions(-)
> >
> > diff --git a/lib/rconn.c b/lib/rconn.c
> > index 1ea022b..2049a90 100644
> > --- a/lib/rconn.c
> > +++ b/lib/rconn.c
> > @@ -649,14 +649,13 @@ int
> >  rconn_send_with_limit(struct rconn *rc, struct ofpbuf *b,
> >                        struct rconn_packet_counter *counter, int
> > queue_limit)
> >  {
> > -    int retval;
> > -    retval = (counter->n_packets >= queue_limit
> > -              ? EAGAIN
> > -              : rconn_send(rc, b, counter));
> > -    if (retval) {
> > +    if (counter->n_packets < queue_limit) {
> > +        return rconn_send(rc, b, counter);
> > +    } else {
> >          COVERAGE_INC(rconn_overflow);
> > +        ofpbuf_delete(b);
> > +        return EAGAIN;
> >      }
> > -    return retval;
> >  }
> >
> >  /* Returns the total number of packets successfully sent on the underlying
> > --
> > 1.7.2.5
> >
> > _______________________________________________
> > dev mailing list
> > dev at openvswitch.org
> > http://openvswitch.org/mailman/listinfo/dev
> >



More information about the dev mailing list