Message ID | 3e412b5659ec2310c5c615760dfe5eac18dd7ebd.1713797103.git.petrm@nvidia.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 54225988889931467a9b55fdbef534079b665519 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | mlxsw: Various ACL fixes | expand |
On Mon, Apr 22, 2024 at 05:25:57PM +0200, Petr Machata wrote: > From: Ido Schimmel <idosch@nvidia.com> > > The rehash delayed work migrates filters from one region to another > according to the number of available credits. > > The migrated from region is destroyed at the end of the work if the > number of credits is non-negative as the assumption is that this is > indicative of migration being complete. This assumption is incorrect as > a non-negative number of credits can also be the result of a failed > migration. > > The destruction of a region that still has filters referencing it can > result in a use-after-free [1]. > > Fix by not destroying the region if migration failed. > > [1] > BUG: KASAN: slab-use-after-free in mlxsw_sp_acl_ctcam_region_entry_remove+0x21d/0x230 ... > Fixes: c9c9af91f1d9 ("mlxsw: spectrum_acl: Allow to interrupt/continue rehash work") > Signed-off-by: Ido Schimmel <idosch@nvidia.com> > Tested-by: Alexander Zubkov <green@qrator.net> > Reviewed-by: Petr Machata <petrm@nvidia.com> > Signed-off-by: Petr Machata <petrm@nvidia.com> Reviewed-by: Simon Horman <horms@kernel.org> ...
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c index 7e69225c057d..1ff0b2c7c11d 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c @@ -1451,6 +1451,7 @@ mlxsw_sp_acl_tcam_vregion_rehash(struct mlxsw_sp *mlxsw_sp, ctx, credits); if (err) { dev_err(mlxsw_sp->bus_info->dev, "Failed to migrate vregion\n"); + return; } if (*credits >= 0)