Subject: Re: [Bugme-new] [Bug 9758] New: net_device refcnt bug when NFQUEUEing bridged packets

From: Stephen Hemminger <[email-masked]>
Date: Wed, 16 Jan 2008 10:56:32 -0800

On Wed, 16 Jan 2008 05:59:21 +0100
Patrick McHardy <[email-masked]> wrote:

> Patrick McHardy wrote:
> > Very nice catch, that explains quite a few bug reports about
> > refcnt leaks. Your patch looks correct and performs the copying
> > in the logically correct place, it would be nicer to keep this
> > crap limited to bridge netfilter however.
> > 
> > What should work is to perform the copying in br_netfilter.c
> > at the spots where phsyoutdev is assigned. As an optimization
> > we should be able to avoid the copying in most cases by
> > checking that the bridge info has a refcount above 1.
> > 
> > Could you test whether this patch also fixes the problem?
> 
> 
> That patch had a bug, we need to set the refcount of the
> new bridge info to 1 after performing the copy.
> 

This looks good, but you could use a structure assignment rather memcpy
(just a personal style preference because assignment is typed and memcpy
is not).