[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150628170953.GW9469@lunn.ch>
Date: Sun, 28 Jun 2015 19:09:53 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Gilad Ben-Yossef <gilad@...yossef.com>
Cc: Gilad Ben-Yossef <giladb@...hip.com>,
David Miller <davem@...emloft.net>,
Netdev <netdev@...r.kernel.org>,
Florian Fainelli <f.fainelli@...il.com>,
Guenter Roeck <linux@...ck-us.net>,
Scott Feldman <sfeldma@...il.com>
Subject: Re: [PATCH net] dsa: fix promiscuity leak on slave dev open error
> 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);
on suggests it is an absolute, when in fact you are passing an
increment, so i don't think it is much of an improvement.
Adding #define, PROMISC_INC and PROMISC_DEC might be clearer, and
since this is not a fast path, you could consider parameter
validation. Or dev_get_promiscuity(), det_put_promiscuity().
> 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...
There was only one instance of it wrong, so it is not a very big
problem. I would say it is not worth the churn.
Andrew
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists