* [patch net] mlxsw: spectrum: Fix incorrect reuse of MID entries
@ 2016-10-30 9:09 Jiri Pirko
2016-10-31 19:36 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Jiri Pirko @ 2016-10-30 9:09 UTC (permalink / raw)
To: netdev; +Cc: davem, eladr, idosch, yotamg, nogahf, ogerlitz
From: Ido Schimmel <idosch@mellanox.com>
In the device, a MID entry represents a group of local ports, which can
later be bound to a MDB entry.
The lookup of an existing MID entry is currently done using the provided
MC MAC address and VID, from the Linux bridge. However, this can result
in an incorrect reuse of the same MID index in different VLAN-unaware
bridges (same IP MC group and VID 0).
Fix this by performing the lookup based on FID instead of VID, which is
unique across different bridges.
Fixes: 3a49b4fde2a1 ("mlxsw: Adding layer 2 multicast support")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Elad Raz <eladr@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 2 +-
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c | 14 +++++++-------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
index 9b22863..97bbc1d 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
@@ -115,7 +115,7 @@ struct mlxsw_sp_rif {
struct mlxsw_sp_mid {
struct list_head list;
unsigned char addr[ETH_ALEN];
- u16 vid;
+ u16 fid;
u16 mid;
unsigned int ref_count;
};
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
index 5e00c79..1e2c8ec 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
@@ -929,12 +929,12 @@ static int mlxsw_sp_port_smid_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 mid,
static struct mlxsw_sp_mid *__mlxsw_sp_mc_get(struct mlxsw_sp *mlxsw_sp,
const unsigned char *addr,
- u16 vid)
+ u16 fid)
{
struct mlxsw_sp_mid *mid;
list_for_each_entry(mid, &mlxsw_sp->br_mids.list, list) {
- if (ether_addr_equal(mid->addr, addr) && mid->vid == vid)
+ if (ether_addr_equal(mid->addr, addr) && mid->fid == fid)
return mid;
}
return NULL;
@@ -942,7 +942,7 @@ static struct mlxsw_sp_mid *__mlxsw_sp_mc_get(struct mlxsw_sp *mlxsw_sp,
static struct mlxsw_sp_mid *__mlxsw_sp_mc_alloc(struct mlxsw_sp *mlxsw_sp,
const unsigned char *addr,
- u16 vid)
+ u16 fid)
{
struct mlxsw_sp_mid *mid;
u16 mid_idx;
@@ -958,7 +958,7 @@ static struct mlxsw_sp_mid *__mlxsw_sp_mc_alloc(struct mlxsw_sp *mlxsw_sp,
set_bit(mid_idx, mlxsw_sp->br_mids.mapped);
ether_addr_copy(mid->addr, addr);
- mid->vid = vid;
+ mid->fid = fid;
mid->mid = mid_idx;
mid->ref_count = 0;
list_add_tail(&mid->list, &mlxsw_sp->br_mids.list);
@@ -991,9 +991,9 @@ static int mlxsw_sp_port_mdb_add(struct mlxsw_sp_port *mlxsw_sp_port,
if (switchdev_trans_ph_prepare(trans))
return 0;
- mid = __mlxsw_sp_mc_get(mlxsw_sp, mdb->addr, mdb->vid);
+ mid = __mlxsw_sp_mc_get(mlxsw_sp, mdb->addr, fid);
if (!mid) {
- mid = __mlxsw_sp_mc_alloc(mlxsw_sp, mdb->addr, mdb->vid);
+ mid = __mlxsw_sp_mc_alloc(mlxsw_sp, mdb->addr, fid);
if (!mid) {
netdev_err(dev, "Unable to allocate MC group\n");
return -ENOMEM;
@@ -1137,7 +1137,7 @@ static int mlxsw_sp_port_mdb_del(struct mlxsw_sp_port *mlxsw_sp_port,
u16 mid_idx;
int err = 0;
- mid = __mlxsw_sp_mc_get(mlxsw_sp, mdb->addr, mdb->vid);
+ mid = __mlxsw_sp_mc_get(mlxsw_sp, mdb->addr, fid);
if (!mid) {
netdev_err(dev, "Unable to remove port from MC DB\n");
return -EINVAL;
--
2.5.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [patch net] mlxsw: spectrum: Fix incorrect reuse of MID entries
2016-10-30 9:09 [patch net] mlxsw: spectrum: Fix incorrect reuse of MID entries Jiri Pirko
@ 2016-10-31 19:36 ` David Miller
2016-10-31 20:36 ` Ido Schimmel
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2016-10-31 19:36 UTC (permalink / raw)
To: jiri; +Cc: netdev, eladr, idosch, yotamg, nogahf, ogerlitz
From: Jiri Pirko <jiri@resnulli.us>
Date: Sun, 30 Oct 2016 10:09:22 +0100
> From: Ido Schimmel <idosch@mellanox.com>
>
> In the device, a MID entry represents a group of local ports, which can
> later be bound to a MDB entry.
>
> The lookup of an existing MID entry is currently done using the provided
> MC MAC address and VID, from the Linux bridge. However, this can result
> in an incorrect reuse of the same MID index in different VLAN-unaware
> bridges (same IP MC group and VID 0).
>
> Fix this by performing the lookup based on FID instead of VID, which is
> unique across different bridges.
>
> Fixes: 3a49b4fde2a1 ("mlxsw: Adding layer 2 multicast support")
> Signed-off-by: Ido Schimmel <idosch@mellanox.com>
> Acked-by: Elad Raz <eladr@mellanox.com>
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Applied, should I queue this up for -stable?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch net] mlxsw: spectrum: Fix incorrect reuse of MID entries
2016-10-31 19:36 ` David Miller
@ 2016-10-31 20:36 ` Ido Schimmel
0 siblings, 0 replies; 3+ messages in thread
From: Ido Schimmel @ 2016-10-31 20:36 UTC (permalink / raw)
To: David Miller; +Cc: jiri, netdev, eladr, idosch, yotamg, nogahf, ogerlitz
Hi,
On Mon, Oct 31, 2016 at 03:36:06PM -0400, David Miller wrote:
> From: Jiri Pirko <jiri@resnulli.us>
> Date: Sun, 30 Oct 2016 10:09:22 +0100
>
> > From: Ido Schimmel <idosch@mellanox.com>
> >
> > In the device, a MID entry represents a group of local ports, which can
> > later be bound to a MDB entry.
> >
> > The lookup of an existing MID entry is currently done using the provided
> > MC MAC address and VID, from the Linux bridge. However, this can result
> > in an incorrect reuse of the same MID index in different VLAN-unaware
> > bridges (same IP MC group and VID 0).
> >
> > Fix this by performing the lookup based on FID instead of VID, which is
> > unique across different bridges.
> >
> > Fixes: 3a49b4fde2a1 ("mlxsw: Adding layer 2 multicast support")
> > Signed-off-by: Ido Schimmel <idosch@mellanox.com>
> > Acked-by: Elad Raz <eladr@mellanox.com>
> > Signed-off-by: Jiri Pirko <jiri@mellanox.com>
>
> Applied, should I queue this up for -stable?
I don't think it's necessary, but thanks for asking! We recently picked
up the habit of noting what we would like to see in -stable.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-10-31 20:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-30 9:09 [patch net] mlxsw: spectrum: Fix incorrect reuse of MID entries Jiri Pirko
2016-10-31 19:36 ` David Miller
2016-10-31 20:36 ` Ido Schimmel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.