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
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220104222036.giuz2kip33zfr6a6@skbuf>
Date:   Tue, 4 Jan 2022 22:20:36 +0000
From:   Vladimir Oltean <vladimir.oltean@....com>
To:     George McCollister <george.mccollister@...il.com>
CC:     netdev <netdev@...r.kernel.org>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>, Andrew Lunn <andrew@...n.ch>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Florian Fainelli <f.fainelli@...il.com>
Subject: Re: [PATCH net-next 08/15] net: dsa: remove cross-chip support for
 HSR

On Tue, Jan 04, 2022 at 04:03:56PM -0600, George McCollister wrote:
> On Tue, Jan 4, 2022 at 11:14 AM Vladimir Oltean <vladimir.oltean@....com> wrote:
> >
> > The cross-chip notifiers for HSR are bypass operations, meaning that
> > even though all switches in a tree are notified, only the switch
> > specified in the info structure is targeted.
> >
> > We can eliminate the unnecessary complexity by deleting the cross-chip
> > notifier logic and calling the ds->ops straight from port.c.
> >
> > Cc: George McCollister <george.mccollister@...il.com>
> > Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>
> > ---
> >  net/dsa/dsa_priv.h |  2 --
> >  net/dsa/port.c     | 20 ++++++--------------
> >  net/dsa/switch.c   | 24 ------------------------
> >  3 files changed, 6 insertions(+), 40 deletions(-)
> >
> > diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
> > index 54c23479b9ba..b3386d408fc6 100644
> > --- a/net/dsa/dsa_priv.h
> > +++ b/net/dsa/dsa_priv.h
> > @@ -25,8 +25,6 @@ enum {
> >         DSA_NOTIFIER_FDB_DEL,
> >         DSA_NOTIFIER_HOST_FDB_ADD,
> >         DSA_NOTIFIER_HOST_FDB_DEL,
> > -       DSA_NOTIFIER_HSR_JOIN,
> > -       DSA_NOTIFIER_HSR_LEAVE,
> >         DSA_NOTIFIER_LAG_CHANGE,
> >         DSA_NOTIFIER_LAG_JOIN,
> >         DSA_NOTIFIER_LAG_LEAVE,
> > diff --git a/net/dsa/port.c b/net/dsa/port.c
> > index 5c72f890c6a2..9e7c421c47b9 100644
> > --- a/net/dsa/port.c
> > +++ b/net/dsa/port.c
> > @@ -1317,16 +1317,12 @@ EXPORT_SYMBOL_GPL(dsa_port_get_phy_sset_count);
> >
> >  int dsa_port_hsr_join(struct dsa_port *dp, struct net_device *hsr)
> >  {
> > -       struct dsa_notifier_hsr_info info = {
> > -               .sw_index = dp->ds->index,
> > -               .port = dp->index,
> > -               .hsr = hsr,
> > -       };
> > +       struct dsa_switch *ds = dp->ds;
> >         int err;
> >
> >         dp->hsr_dev = hsr;
> >
> > -       err = dsa_port_notify(dp, DSA_NOTIFIER_HSR_JOIN, &info);
> > +       err = ds->ops->port_hsr_join(ds, dp->index, hsr);
> >         if (err)
> >                 dp->hsr_dev = NULL;
> >
> > @@ -1335,20 +1331,16 @@ int dsa_port_hsr_join(struct dsa_port *dp, struct net_device *hsr)
> >
> >  void dsa_port_hsr_leave(struct dsa_port *dp, struct net_device *hsr)
> >  {
> > -       struct dsa_notifier_hsr_info info = {
> > -               .sw_index = dp->ds->index,
> > -               .port = dp->index,
> > -               .hsr = hsr,
> > -       };
> > +       struct dsa_switch *ds = dp->ds;
> >         int err;
> >
> >         dp->hsr_dev = NULL;
> >
> > -       err = dsa_port_notify(dp, DSA_NOTIFIER_HSR_LEAVE, &info);
> > +       err = ds->ops->port_hsr_leave(ds, dp->index, hsr);
> >         if (err)
> >                 dev_err(dp->ds->dev,
> > -                       "port %d failed to notify DSA_NOTIFIER_HSR_LEAVE: %pe\n",
> > -                       dp->index, ERR_PTR(err));
> > +                       "port %d failed to leave HSR %s: %pe\n",
> > +                       dp->index, hsr->name, ERR_PTR(err));
> >  }
> >
> >  int dsa_port_tag_8021q_vlan_add(struct dsa_port *dp, u16 vid, bool broadcast)
> > diff --git a/net/dsa/switch.c b/net/dsa/switch.c
> > index a164ec02b4e9..e3c7d2627a61 100644
> > --- a/net/dsa/switch.c
> > +++ b/net/dsa/switch.c
> > @@ -437,24 +437,6 @@ static int dsa_switch_fdb_del(struct dsa_switch *ds,
> >         return dsa_port_do_fdb_del(dp, info->addr, info->vid);
> >  }
> >
> > -static int dsa_switch_hsr_join(struct dsa_switch *ds,
> > -                              struct dsa_notifier_hsr_info *info)
> > -{
> > -       if (ds->index == info->sw_index && ds->ops->port_hsr_join)
> > -               return ds->ops->port_hsr_join(ds, info->port, info->hsr);
> > -
> > -       return -EOPNOTSUPP;
> > -}
> > -
> > -static int dsa_switch_hsr_leave(struct dsa_switch *ds,
> > -                               struct dsa_notifier_hsr_info *info)
> > -{
> > -       if (ds->index == info->sw_index && ds->ops->port_hsr_leave)
> > -               return ds->ops->port_hsr_leave(ds, info->port, info->hsr);
> > -
> > -       return -EOPNOTSUPP;
> > -}
> > -
> >  static int dsa_switch_lag_change(struct dsa_switch *ds,
> >                                  struct dsa_notifier_lag_info *info)
> >  {
> > @@ -729,12 +711,6 @@ static int dsa_switch_event(struct notifier_block *nb,
> >         case DSA_NOTIFIER_HOST_FDB_DEL:
> >                 err = dsa_switch_host_fdb_del(ds, info);
> >                 break;
> > -       case DSA_NOTIFIER_HSR_JOIN:
> > -               err = dsa_switch_hsr_join(ds, info);
> > -               break;
> > -       case DSA_NOTIFIER_HSR_LEAVE:
> > -               err = dsa_switch_hsr_leave(ds, info);
> > -               break;
> >         case DSA_NOTIFIER_LAG_CHANGE:
> >                 err = dsa_switch_lag_change(ds, info);
> >                 break;
> > --
> > 2.25.1
> >
> 
> Looks good.
> 
> Reviewed-by: George McCollister <george.mccollister@...il.com>

The irony is that the check for the presence of ds->ops->port_hsr_join
and ds->ops->port_hsr_leave vanished. So this is broken, we'd get a NULL
pointer dereference now instead of -EOPNOTSUPP. Sorry for the noise.
I'll add this to the list of things to change when I resend.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ