lkml.org 
[lkml]   [2019]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH AUTOSEL 5.0 24/66] net/mlx5: E-Switch, Protect from invalid memory access in offload fdb table
    Date
    From: Roi Dayan <roid@mellanox.com>

    [ 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.19.1
    \
     
     \ /
      Last update: 2019-04-24 16:46    [W:8.683 / U:0.028 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site