Re: [PATCH net] dsa: fix promiscuity leak on slave dev open error
From: Gilad Ben-Yossef <gilad@benyossef.com>
Date: 2015-06-28 13:19:29
On Fri, Jun 26, 2015 at 6:04 PM, Andrew Lunn [off-list ref] wrote:
On Thu, Jun 25, 2015 at 04:50:13PM +0300, giladb@ezchip.com wrote:quoted
From: Gilad Ben-Yossef <gilad@benyossef.com> DSA master netdev promiscuity counter was not being properly decremented on slave device open error path.
...
Acked-by: Andrew Lunn <andrew@lunn.ch>
Thank you Andrew.
FYI: I grep'ed the whole kernel. This seems to be the only place 0 is passed to dev_set_promiscuity(), i.e. the same bug is not present anywhere else.
It has occurred to me that dev_set_promiscuity() and its brethren dev_set_allmulti() may not be the best of interfaces: - On cursory inspection of code using these function their name implies the value of the relevant counter is set to the value passed as parameter, not incremented by it. - No caller I've managed to spot passes anything but -1 or 1 It seems an interface of int dev_set_promiscuity(struct net_device *dev, bool on); int dev_set_allmulti(struct net_device *dev, bool on); would be as functional (for current users), more readable and less error prone but I am not sure such a tiny problem (if you can call this a problem) is worth the churn... Gilad -- Gilad Ben-Yossef Chief Coffee Drinker gilad@benyossef.com Israel Cell: +972-52-8260388 US Cell: +1-973-8260388 http://benyossef.com "If you take a class in large-scale robotics, can you end up in a situation where the homework eats your dog?" -- Jean-Baptiste Queru