* [ofa-general][PATCH] mlx4: FIX error flow when initializing EQ table
@ 2009-06-07 15:16 Yevgeny Petrilin
2009-06-08 7:40 ` David Miller
2009-06-09 20:46 ` Roland Dreier
0 siblings, 2 replies; 4+ messages in thread
From: Yevgeny Petrilin @ 2009-06-07 15:16 UTC (permalink / raw)
To: rdreier; +Cc: netdev, Christoph Lameter, general
If mlx4_create_eq() would fail for one of EQ's assigned for
completion handling, the code would try to free the same EQ
we failed to create.
The crash was found by Christoph Lameter
Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
---
drivers/net/mlx4/eq.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/net/mlx4/eq.c b/drivers/net/mlx4/eq.c
index 8830dcb..dee1887 100644
--- a/drivers/net/mlx4/eq.c
+++ b/drivers/net/mlx4/eq.c
@@ -623,8 +623,10 @@ int mlx4_init_eq_table(struct mlx4_dev *dev)
err = mlx4_create_eq(dev, dev->caps.num_cqs + MLX4_NUM_SPARE_EQE,
(dev->flags & MLX4_FLAG_MSI_X) ? i : 0,
&priv->eq_table.eq[i]);
- if (err)
+ if (err) {
+ --i;
goto err_out_unmap;
+ }
}
err = mlx4_create_eq(dev, MLX4_NUM_ASYNC_EQE + MLX4_NUM_SPARE_EQE,
--
1.6.1.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [ofa-general][PATCH] mlx4: FIX error flow when initializing EQ table
2009-06-07 15:16 [ofa-general][PATCH] mlx4: FIX error flow when initializing EQ table Yevgeny Petrilin
@ 2009-06-08 7:40 ` David Miller
2009-06-09 20:46 ` Roland Dreier
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2009-06-08 7:40 UTC (permalink / raw)
To: yevgenyp; +Cc: netdev, rdreier, cl, general
From: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Date: Sun, 07 Jun 2009 18:16:09 +0300
> If mlx4_create_eq() would fail for one of EQ's assigned for
> completion handling, the code would try to free the same EQ
> we failed to create.
> The crash was found by Christoph Lameter
>
> Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [ofa-general][PATCH] mlx4: FIX error flow when initializing EQ table
2009-06-07 15:16 [ofa-general][PATCH] mlx4: FIX error flow when initializing EQ table Yevgeny Petrilin
2009-06-08 7:40 ` David Miller
@ 2009-06-09 20:46 ` Roland Dreier
2009-06-10 6:52 ` Yevgeny Petrilin
1 sibling, 1 reply; 4+ messages in thread
From: Roland Dreier @ 2009-06-09 20:46 UTC (permalink / raw)
To: Yevgeny Petrilin; +Cc: netdev, general, Christoph Lameter
> If mlx4_create_eq() would fail for one of EQ's assigned for
> completion handling, the code would try to free the same EQ
> we failed to create.
> The crash was found by Christoph Lameter
Thanks, good catch. However looking at the code it seems that a simpler
way to fix this would be as below. Can you confirm that this works too?
---
drivers/net/mlx4/eq.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/mlx4/eq.c b/drivers/net/mlx4/eq.c
index 8830dcb..033817e 100644
--- a/drivers/net/mlx4/eq.c
+++ b/drivers/net/mlx4/eq.c
@@ -677,12 +677,12 @@ err_out_async:
mlx4_free_eq(dev, &priv->eq_table.eq[dev->caps.num_comp_vectors]);
err_out_comp:
- i = dev->caps.num_comp_vectors - 1;
+ i = dev->caps.num_comp_vectors;
err_out_unmap:
- while (i >= 0) {
- mlx4_free_eq(dev, &priv->eq_table.eq[i]);
+ while (i > 0) {
--i;
+ mlx4_free_eq(dev, &priv->eq_table.eq[i]);
}
mlx4_unmap_clr_int(dev);
mlx4_free_irqs(dev);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [ofa-general][PATCH] mlx4: FIX error flow when initializing EQ table
2009-06-09 20:46 ` Roland Dreier
@ 2009-06-10 6:52 ` Yevgeny Petrilin
0 siblings, 0 replies; 4+ messages in thread
From: Yevgeny Petrilin @ 2009-06-10 6:52 UTC (permalink / raw)
To: Roland Dreier; +Cc: netdev, Christoph Lameter, general
Roland Dreier wrote:
> > If mlx4_create_eq() would fail for one of EQ's assigned for
> > completion handling, the code would try to free the same EQ
> > we failed to create.
> > The crash was found by Christoph Lameter
>
> Thanks, good catch. However looking at the code it seems that a simpler
> way to fix this would be as below. Can you confirm that this works too?
> ---
> drivers/net/mlx4/eq.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/mlx4/eq.c b/drivers/net/mlx4/eq.c
> index 8830dcb..033817e 100644
> --- a/drivers/net/mlx4/eq.c
> +++ b/drivers/net/mlx4/eq.c
> @@ -677,12 +677,12 @@ err_out_async:
> mlx4_free_eq(dev, &priv->eq_table.eq[dev->caps.num_comp_vectors]);
>
> err_out_comp:
> - i = dev->caps.num_comp_vectors - 1;
> + i = dev->caps.num_comp_vectors;
>
> err_out_unmap:
> - while (i >= 0) {
> - mlx4_free_eq(dev, &priv->eq_table.eq[i]);
> + while (i > 0) {
> --i;
> + mlx4_free_eq(dev, &priv->eq_table.eq[i]);
> }
> mlx4_unmap_clr_int(dev);
> mlx4_free_irqs(dev);
>
Yes, it also works
Yevgeny
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-06-10 6:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-07 15:16 [ofa-general][PATCH] mlx4: FIX error flow when initializing EQ table Yevgeny Petrilin
2009-06-08 7:40 ` David Miller
2009-06-09 20:46 ` Roland Dreier
2009-06-10 6:52 ` Yevgeny Petrilin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).