lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Thu, 17 Dec 2020 11:03:11 +0000 From: Vladimir Oltean <vladimir.oltean@....com> To: "David S. Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, "netdev@...r.kernel.org" <netdev@...r.kernel.org> CC: Florian Fainelli <f.fainelli@...il.com>, Andrew Lunn <andrew@...n.ch>, Vivien Didelot <vivien.didelot@...il.com>, Vladimir Oltean <olteanv@...il.com>, Kurt Kanzenbach <kurt@...utronix.de>, Hauke Mehrtens <hauke@...ke-m.de>, Woojung Huh <woojung.huh@...rochip.com>, Microchip Linux Driver Support <UNGLinuxDriver@...rochip.com>, Sean Wang <sean.wang@...iatek.com>, Landen Chao <Landen.Chao@...iatek.com>, Claudiu Manoil <claudiu.manoil@....com>, Alexandre Belloni <alexandre.belloni@...tlin.com>, Linus Walleij <linus.walleij@...aro.org>, Vadym Kochan <vkochan@...vell.com>, Taras Chornyi <tchornyi@...vell.com>, Jiri Pirko <jiri@...dia.com>, Ido Schimmel <idosch@...dia.com>, Grygorii Strashko <grygorii.strashko@...com>, Ioana Ciornei <ioana.ciornei@....com>, Ivan Vecera <ivecera@...hat.com> Subject: Re: [RFC PATCH net-next 5/9] net: dsa: remove the transactional logic from MDB entries On Thu, Dec 17, 2020 at 03:58:18AM +0200, Vladimir Oltean wrote: > For many drivers, the .port_mdb_prepare callback was not a good opportunity > to avoid any error condition, and they would suppress errors found during > the actual commit phase. > > Where a logical separation between the prepare and the commit phase > existed, the function that used to implement the .port_mdb_prepare > callback still exists, but now it is called directly from .port_mdb_add, > which was modified to return an int code. > > Signed-off-by: Vladimir Oltean <vladimir.oltean@....com> > --- [...] > diff --git a/net/dsa/switch.c b/net/dsa/switch.c > index 39848eac1da8..65124bc3ddfb 100644 > --- a/net/dsa/switch.c > +++ b/net/dsa/switch.c > @@ -178,35 +178,13 @@ static bool dsa_switch_mdb_match(struct dsa_switch *ds, int port, > return false; > } > > -static int dsa_switch_mdb_prepare(struct dsa_switch *ds, > - struct dsa_notifier_mdb_info *info) > -{ > - int port, err; > - > - if (!ds->ops->port_mdb_prepare || !ds->ops->port_mdb_add) > - return -EOPNOTSUPP; > - > - for (port = 0; port < ds->num_ports; port++) { > - if (dsa_switch_mdb_match(ds, port, info)) { > - err = ds->ops->port_mdb_prepare(ds, port, info->mdb); > - if (err) > - return err; > - } > - } > - > - return 0; > -} > - > static int dsa_switch_mdb_add(struct dsa_switch *ds, > struct dsa_notifier_mdb_info *info) > { > int port; > > - if (switchdev_trans_ph_prepare(info->trans)) > - return dsa_switch_mdb_prepare(ds, info); > - > if (!ds->ops->port_mdb_add) > - return 0; > + return -EOPNOTSUPP; > > for (port = 0; port < ds->num_ports; port++) > if (dsa_switch_mdb_match(ds, port, info)) > -- > 2.25.1 > For anybody who wants to test, I forgot to update dsa_switch_mdb_add to propagate the errors. It should look like this: static int dsa_switch_mdb_add(struct dsa_switch *ds, struct dsa_notifier_mdb_info *info) { int err = 0; int port; if (!ds->ops->port_mdb_add) return -EOPNOTSUPP; for (port = 0; port < ds->num_ports; port++) { if (dsa_switch_mdb_match(ds, port, info)) { err = ds->ops->port_mdb_add(ds, port, info->mdb); if (err) break; } } return err; }
Powered by blists - more mailing lists