aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorYevgeny Petrilin <yevgenyp@mellanox.co.il>2011-03-30 19:28:52 -0400
committerDavid S. Miller <davem@davemloft.net>2011-03-31 05:52:17 -0400
commit53020092bd89b0d4ccc5368a3956f43cb43e5665 (patch)
treee77703aed0ac7d44fa82736c935039638ea6c280 /drivers/net
parent5e8996e72899847269ca36061ea33ea24bf6cb90 (diff)
mlx4: Fixing use after free
In case of allocation failure, tried to use the promiscuous QP entry that was previously freed. Now freeing this entry only in case we will not put it back to the list of promiscuous entries. Reported-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/mlx4/mcg.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/mlx4/mcg.c b/drivers/net/mlx4/mcg.c
index e71372aa9cc4..37150b2f6425 100644
--- a/drivers/net/mlx4/mcg.c
+++ b/drivers/net/mlx4/mcg.c
@@ -469,7 +469,6 @@ static int remove_promisc_qp(struct mlx4_dev *dev, u8 vep_num, u8 port,
469 469
470 /*remove from list of promisc qps */ 470 /*remove from list of promisc qps */
471 list_del(&pqp->list); 471 list_del(&pqp->list);
472 kfree(pqp);
473 472
474 /* set the default entry not to include the removed one */ 473 /* set the default entry not to include the removed one */
475 mailbox = mlx4_alloc_cmd_mailbox(dev); 474 mailbox = mlx4_alloc_cmd_mailbox(dev);
@@ -528,6 +527,8 @@ out_mailbox:
528out_list: 527out_list:
529 if (back_to_list) 528 if (back_to_list)
530 list_add_tail(&pqp->list, &s_steer->promisc_qps[steer]); 529 list_add_tail(&pqp->list, &s_steer->promisc_qps[steer]);
530 else
531 kfree(pqp);
531out_mutex: 532out_mutex:
532 mutex_unlock(&priv->mcg_table.mutex); 533 mutex_unlock(&priv->mcg_table.mutex);
533 return err; 534 return err;