Patchwork [net-next,1/2] mlx4_core: fix mtt range deallocation

login
register
mail settings
Submitter Yevgeny Petrilin
Date Jan. 2, 2012, 2:07 p.m.
Message ID <4F01BA2B.1060605@mellanox.co.il>
Download mbox | patch
Permalink /patch/133867/
State Accepted
Delegated to: David Miller
Headers show

Comments

Yevgeny Petrilin - Jan. 2, 2012, 2:07 p.m.
From: Marcel Apfelbaum <marcela@mellanox.co.il>

The mtt range was allocated in mtt units but deallocated
in segments. Among the rest, this caused crash during hotplug removal

Reported-by: Yinghai Lu <yinghai@kernel.org> 
Signed-off-by: Marcel Apfelbaum <marcela@mellanox.co.il>
Reviewed-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
---
 drivers/net/ethernet/mellanox/mlx4/mr.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Yinghai Lu - Jan. 2, 2012, 10:05 p.m.
On Mon, Jan 2, 2012 at 6:07 AM, Yevgeny Petrilin
<yevgenyp@mellanox.co.il> wrote:
> From: Marcel Apfelbaum <marcela@mellanox.co.il>
>
> The mtt range was allocated in mtt units but deallocated
> in segments. Among the rest, this caused crash during hotplug removal
>
> Reported-by: Yinghai Lu <yinghai@kernel.org>
> Signed-off-by: Marcel Apfelbaum <marcela@mellanox.co.il>
> Reviewed-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
> ---
>  drivers/net/ethernet/mellanox/mlx4/mr.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx4/mr.c b/drivers/net/ethernet/mellanox/mlx4/mr.c
> index f7243b2..01df556 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/mr.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/mr.c
> @@ -239,8 +239,8 @@ void __mlx4_free_mtt_range(struct mlx4_dev *dev, u32 offset, int order)
>        first_seg = offset / (1 << log_mtts_per_seg);
>
>        mlx4_buddy_free(&mr_table->mtt_buddy, first_seg, seg_order);
> -       mlx4_table_put_range(dev, &mr_table->mtt_table, first_seg,
> -                            first_seg + (1 << seg_order) - 1);
> +       mlx4_table_put_range(dev, &mr_table->mtt_table, offset,
> +                            offset + (1 << order) - 1);
>  }
>
>  static void mlx4_free_mtt_range(struct mlx4_dev *dev, u32 offset, int order)

Tested-by: Yinghai Lu <yinghai@kernel.org>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Jan. 3, 2012, 6:01 p.m.
From: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Date: Mon, 2 Jan 2012 16:07:39 +0200

> From: Marcel Apfelbaum <marcela@mellanox.co.il>
> 
> The mtt range was allocated in mtt units but deallocated
> in segments. Among the rest, this caused crash during hotplug removal
> 
> Reported-by: Yinghai Lu <yinghai@kernel.org> 
> Signed-off-by: Marcel Apfelbaum <marcela@mellanox.co.il>
> Reviewed-by: Jack Morgenstein <jackm@dev.mellanox.co.il>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx4/mr.c b/drivers/net/ethernet/mellanox/mlx4/mr.c
index f7243b2..01df556 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mr.c
+++ b/drivers/net/ethernet/mellanox/mlx4/mr.c
@@ -239,8 +239,8 @@  void __mlx4_free_mtt_range(struct mlx4_dev *dev, u32 offset, int order)
 	first_seg = offset / (1 << log_mtts_per_seg);
 
 	mlx4_buddy_free(&mr_table->mtt_buddy, first_seg, seg_order);
-	mlx4_table_put_range(dev, &mr_table->mtt_table, first_seg,
-			     first_seg + (1 << seg_order) - 1);
+	mlx4_table_put_range(dev, &mr_table->mtt_table, offset,
+			     offset + (1 << order) - 1);
 }
 
 static void mlx4_free_mtt_range(struct mlx4_dev *dev, u32 offset, int order)