mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-16 17:23:55 +08:00
net: switchdev: zero-initialize struct switchdev_notifier_fdb_info emitted by drivers towards the bridge
The blamed commit added a new field to struct switchdev_notifier_fdb_info,
but did not make sure that all call paths set it to something valid.
For example, a switchdev driver may emit a SWITCHDEV_FDB_ADD_TO_BRIDGE
notifier, and since the 'is_local' flag is not set, it contains junk
from the stack, so the bridge might interpret those notifications as
being for local FDB entries when that was not intended.
To avoid that now and in the future, zero-initialize all
switchdev_notifier_fdb_info structures created by drivers such that all
newly added fields to not need to touch drivers again.
Fixes: 2c4eca3ef7
("net: bridge: switchdev: include local flag in FDB notifications")
Reported-by: Ido Schimmel <idosch@idosch.org>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Tested-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Reviewed-by: Karsten Graul <kgraul@linux.ibm.com>
Link: https://lore.kernel.org/r/20210810115024.1629983-1-vladimir.oltean@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
45a687879b
commit
c35b57ceff
@ -748,7 +748,7 @@ static void
|
||||
prestera_fdb_offload_notify(struct prestera_port *port,
|
||||
struct switchdev_notifier_fdb_info *info)
|
||||
{
|
||||
struct switchdev_notifier_fdb_info send_info;
|
||||
struct switchdev_notifier_fdb_info send_info = {};
|
||||
|
||||
send_info.addr = info->addr;
|
||||
send_info.vid = info->vid;
|
||||
@ -1123,7 +1123,7 @@ static int prestera_switchdev_blk_event(struct notifier_block *unused,
|
||||
static void prestera_fdb_event(struct prestera_switch *sw,
|
||||
struct prestera_event *evt, void *arg)
|
||||
{
|
||||
struct switchdev_notifier_fdb_info info;
|
||||
struct switchdev_notifier_fdb_info info = {};
|
||||
struct net_device *dev = NULL;
|
||||
struct prestera_port *port;
|
||||
struct prestera_lag *lag;
|
||||
|
@ -69,7 +69,7 @@ static void
|
||||
mlx5_esw_bridge_fdb_offload_notify(struct net_device *dev, const unsigned char *addr, u16 vid,
|
||||
unsigned long val)
|
||||
{
|
||||
struct switchdev_notifier_fdb_info send_info;
|
||||
struct switchdev_notifier_fdb_info send_info = {};
|
||||
|
||||
send_info.addr = addr;
|
||||
send_info.vid = vid;
|
||||
|
@ -9079,7 +9079,7 @@ mlxsw_sp_rif_fid_fid_get(struct mlxsw_sp_rif *rif,
|
||||
|
||||
static void mlxsw_sp_rif_fid_fdb_del(struct mlxsw_sp_rif *rif, const char *mac)
|
||||
{
|
||||
struct switchdev_notifier_fdb_info info;
|
||||
struct switchdev_notifier_fdb_info info = {};
|
||||
struct net_device *dev;
|
||||
|
||||
dev = br_fdb_find_port(rif->dev, mac, 0);
|
||||
@ -9127,8 +9127,8 @@ mlxsw_sp_rif_vlan_fid_get(struct mlxsw_sp_rif *rif,
|
||||
|
||||
static void mlxsw_sp_rif_vlan_fdb_del(struct mlxsw_sp_rif *rif, const char *mac)
|
||||
{
|
||||
struct switchdev_notifier_fdb_info info = {};
|
||||
u16 vid = mlxsw_sp_fid_8021q_vid(rif->fid);
|
||||
struct switchdev_notifier_fdb_info info;
|
||||
struct net_device *br_dev;
|
||||
struct net_device *dev;
|
||||
|
||||
|
@ -2508,7 +2508,7 @@ mlxsw_sp_fdb_call_notifiers(enum switchdev_notifier_type type,
|
||||
const char *mac, u16 vid,
|
||||
struct net_device *dev, bool offloaded)
|
||||
{
|
||||
struct switchdev_notifier_fdb_info info;
|
||||
struct switchdev_notifier_fdb_info info = {};
|
||||
|
||||
info.addr = mac;
|
||||
info.vid = vid;
|
||||
|
@ -277,7 +277,7 @@ static void sparx5_fdb_call_notifiers(enum switchdev_notifier_type type,
|
||||
const char *mac, u16 vid,
|
||||
struct net_device *dev, bool offloaded)
|
||||
{
|
||||
struct switchdev_notifier_fdb_info info;
|
||||
struct switchdev_notifier_fdb_info info = {};
|
||||
|
||||
info.addr = mac;
|
||||
info.vid = vid;
|
||||
|
@ -2715,7 +2715,7 @@ static void
|
||||
rocker_fdb_offload_notify(struct rocker_port *rocker_port,
|
||||
struct switchdev_notifier_fdb_info *recv_info)
|
||||
{
|
||||
struct switchdev_notifier_fdb_info info;
|
||||
struct switchdev_notifier_fdb_info info = {};
|
||||
|
||||
info.addr = recv_info->addr;
|
||||
info.vid = recv_info->vid;
|
||||
|
@ -1822,7 +1822,7 @@ static void ofdpa_port_fdb_learn_work(struct work_struct *work)
|
||||
container_of(work, struct ofdpa_fdb_learn_work, work);
|
||||
bool removing = (lw->flags & OFDPA_OP_FLAG_REMOVE);
|
||||
bool learned = (lw->flags & OFDPA_OP_FLAG_LEARNED);
|
||||
struct switchdev_notifier_fdb_info info;
|
||||
struct switchdev_notifier_fdb_info info = {};
|
||||
|
||||
info.addr = lw->addr;
|
||||
info.vid = lw->vid;
|
||||
|
@ -358,7 +358,7 @@ static int am65_cpsw_port_obj_del(struct net_device *ndev, const void *ctx,
|
||||
static void am65_cpsw_fdb_offload_notify(struct net_device *ndev,
|
||||
struct switchdev_notifier_fdb_info *rcv)
|
||||
{
|
||||
struct switchdev_notifier_fdb_info info;
|
||||
struct switchdev_notifier_fdb_info info = {};
|
||||
|
||||
info.addr = rcv->addr;
|
||||
info.vid = rcv->vid;
|
||||
|
@ -368,7 +368,7 @@ static int cpsw_port_obj_del(struct net_device *ndev, const void *ctx,
|
||||
static void cpsw_fdb_offload_notify(struct net_device *ndev,
|
||||
struct switchdev_notifier_fdb_info *rcv)
|
||||
{
|
||||
struct switchdev_notifier_fdb_info info;
|
||||
struct switchdev_notifier_fdb_info info = {};
|
||||
|
||||
info.addr = rcv->addr;
|
||||
info.vid = rcv->vid;
|
||||
|
@ -279,7 +279,7 @@ static void qeth_l2_set_pnso_mode(struct qeth_card *card,
|
||||
|
||||
static void qeth_l2_dev2br_fdb_flush(struct qeth_card *card)
|
||||
{
|
||||
struct switchdev_notifier_fdb_info info;
|
||||
struct switchdev_notifier_fdb_info info = {};
|
||||
|
||||
QETH_CARD_TEXT(card, 2, "fdbflush");
|
||||
|
||||
@ -679,7 +679,7 @@ static void qeth_l2_dev2br_fdb_notify(struct qeth_card *card, u8 code,
|
||||
struct net_if_token *token,
|
||||
struct mac_addr_lnid *addr_lnid)
|
||||
{
|
||||
struct switchdev_notifier_fdb_info info;
|
||||
struct switchdev_notifier_fdb_info info = {};
|
||||
u8 ntfy_mac[ETH_ALEN];
|
||||
|
||||
ether_addr_copy(ntfy_mac, addr_lnid->mac);
|
||||
|
@ -2291,8 +2291,8 @@ static int dsa_slave_netdevice_event(struct notifier_block *nb,
|
||||
static void
|
||||
dsa_fdb_offload_notify(struct dsa_switchdev_event_work *switchdev_work)
|
||||
{
|
||||
struct switchdev_notifier_fdb_info info = {};
|
||||
struct dsa_switch *ds = switchdev_work->ds;
|
||||
struct switchdev_notifier_fdb_info info;
|
||||
struct dsa_port *dp;
|
||||
|
||||
if (!dsa_is_user_port(ds, switchdev_work->port))
|
||||
|
Loading…
Reference in New Issue
Block a user