Subject: Re: [net-next-2.6 PATCH v5 0/3] Introduce n-tuple ethtool support

From: Peter P Waskiewicz Jr <[email-masked]>
Date: Wed, 10 Feb 2010 20:18:33 -0800

On Wed, 2010-02-10 at 19:54 -0800, David Miller wrote:
> From: Jeff Kirsher <[email-masked]>
> Date: Wed, 10 Feb 2010 18:07:18 -0800
> 
> > One more round of fixes, based on feedback from Patrick McHardy
> > 
> > 1) Change the list count to an unsigned value
> > 2) Fix a memory leak
> > 3) Removed an unnecessary list traversal in the ethtool core
> > 4) Moved all list destruction to a helper function, allowing the driver
> > to control when it clears the list (aside from when free_netdev() kills
> > the cached list).
> 
> All applied, thanks.
> 
> Pj, can you look a shoring up the behavior of one more thing for me?
> 
> When rules get added, it first installs the filter by calling into
> the driver.
> 
> _Then_ is tries to add the software copy of the rule to the device
> list.  This does an allocation which may fail.
> 
> If it does fail, we return -ENOMEM but we left the device configured
> with the new rule.
> 
> Probably better to do it something like:
> 
> 	p = NULL;
> 	if (need_sw_rule_list)
> 		p = alloc_rule();
> 		if (!p)
> 			return -ENOMEM;
> 	}
> 
> 	ret = op->install_rule();
> 	if (ret) {
> 		kfree(p);
> 		return ret;
> 	}
> 	
> 	if (need_sw_rule_list)
> 		sw_rule_insert(dev, p);
> 
> You get the idea, we can do the kfree() unconditonally because kfree(NULL)
> is OK, etc.

No problem.  I'll get a patch together asap for 2.6.34.

Also, probably for 2.6.35, I'm going to try and add a remove capability.

Cheers,
-PJ