| From 679ea31f92530a495d2368e18cdcfcf7fbe7d059 Mon Sep 17 00:00:00 2001 |
| From: Roi Dayan <roid@mellanox.com> |
| Date: Thu, 21 Mar 2019 15:51:35 -0700 |
| Subject: net/mlx5: E-Switch, Protect from invalid memory access in offload fdb |
| table |
| |
| [ Upstream commit 5c1d260ed10cf08dd7a0299c103ad0a3f9a9f7a1 ] |
| |
| The esw offloads structures share a union with the legacy mode structs. |
| Reset the offloads struct to zero in init to protect from null |
| assumptions made by the legacy mode code. |
| |
| Signed-off-by: Roi Dayan <roid@mellanox.com> |
| Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com> |
| Signed-off-by: Saeed Mahameed <saeedm@mellanox.com> |
| Signed-off-by: Sasha Levin (Microsoft) <sashal@kernel.org> |
| --- |
| drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 1 + |
| 1 file changed, 1 insertion(+) |
| |
| diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c |
| index d4e6fe5b9300..ce5766a26baa 100644 |
| --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c |
| +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c |
| @@ -1402,6 +1402,7 @@ int esw_offloads_init(struct mlx5_eswitch *esw, int nvports) |
| { |
| int err; |
| |
| + memset(&esw->fdb_table.offloads, 0, sizeof(struct offloads_fdb)); |
| mutex_init(&esw->fdb_table.offloads.fdb_prio_lock); |
| |
| err = esw_create_offloads_fdb_tables(esw, nvports); |
| -- |
| 2.20.1 |
| |