mlx4: Fixing use after free
Subsystems (2)
PATCH 1/1 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 <[email protected]>
Signed-off-by Yevgeny Petrilin <[email protected]>
--- drivers/net/mlx4/mcg.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/net/mlx4/mcg.c +2 -1
@@ -469,7 +469,6 @@ static int remove_promisc_qp(struct mlx4_dev *dev, u8 vep_num, u8 port,/*remove from list of promisc qps */ list_del (&pqp->list); -kfree (pqp);/* set the default entry not to include the removed one */ mailbox =mlx4_alloc_cmd_mailbox (dev);
@@ -528,6 +527,8 @@ out_mailbox: out_list:if (back_to_list)list_add_tail (&pqp->list, &s_steer->promisc_qps[steer]); +else +kfree (pqp); out_mutex:mutex_unlock (&priv->mcg_table.mutex);return err;
Signature · 1 line
1.6.0.2
From: Yevgeny Petrilin <[email protected]>
Date: Thu, 31 Mar 2011 11:28:52 +0200
Quoted 8 lines
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 <[email protected]>Signed-off-by Yevgeny Petrilin <[email protected]>
Applied.