switchdev: remove pointers from switchdev objects
When object is used in deferred work, we cannot use pointers in switchdev object structures because the memory they point at may be already used by someone else. So rather do local copy of the value. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Acked-by: Scott Feldman <sfeldma@gmail.com> Reviewed-by: John Fastabend <john.r.fastabend@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
0bc05d585d
commit
850d0cbc91
@@ -4469,7 +4469,7 @@ static int rocker_port_obj_add(struct net_device *dev,
|
||||
fib4 = SWITCHDEV_OBJ_IPV4_FIB(obj);
|
||||
err = rocker_port_fib_ipv4(rocker_port, trans,
|
||||
htonl(fib4->dst), fib4->dst_len,
|
||||
fib4->fi, fib4->tb_id, 0);
|
||||
&fib4->fi, fib4->tb_id, 0);
|
||||
break;
|
||||
case SWITCHDEV_OBJ_ID_PORT_FDB:
|
||||
err = rocker_port_fdb_add(rocker_port, trans,
|
||||
@@ -4541,7 +4541,7 @@ static int rocker_port_obj_del(struct net_device *dev,
|
||||
fib4 = SWITCHDEV_OBJ_IPV4_FIB(obj);
|
||||
err = rocker_port_fib_ipv4(rocker_port, NULL,
|
||||
htonl(fib4->dst), fib4->dst_len,
|
||||
fib4->fi, fib4->tb_id,
|
||||
&fib4->fi, fib4->tb_id,
|
||||
ROCKER_OP_FLAG_REMOVE);
|
||||
break;
|
||||
case SWITCHDEV_OBJ_ID_PORT_FDB:
|
||||
@@ -4571,7 +4571,7 @@ static int rocker_port_fdb_dump(const struct rocker_port *rocker_port,
|
||||
hash_for_each_safe(rocker->fdb_tbl, bkt, tmp, found, entry) {
|
||||
if (found->key.rocker_port != rocker_port)
|
||||
continue;
|
||||
fdb->addr = found->key.addr;
|
||||
ether_addr_copy(fdb->addr, found->key.addr);
|
||||
fdb->ndm_state = NUD_REACHABLE;
|
||||
fdb->vid = rocker_port_vlan_to_vid(rocker_port,
|
||||
found->key.vlan_id);
|
||||
|
Reference in New Issue
Block a user