Skip to content

Commit a14b289

Browse files
mkozlowskidavem330
authored andcommitted
mlx4: fix kfree on error path in new_steering_entry()
On error path kfree() should get pointer to memory allocated by kmalloc() not the address of variable holding it (which is on stack). Signed-off-by: Mariusz Kozlowski <mk@lab.zgora.pl> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 2fceec1 commit a14b289

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/net/mlx4/mcg.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ static int new_steering_entry(struct mlx4_dev *dev, u8 vep_num, u8 port,
111111
u32 members_count;
112112
struct mlx4_steer_index *new_entry;
113113
struct mlx4_promisc_qp *pqp;
114-
struct mlx4_promisc_qp *dqp;
114+
struct mlx4_promisc_qp *dqp = NULL;
115115
u32 prot;
116116
int err;
117117
u8 pf_num;
@@ -184,7 +184,7 @@ static int new_steering_entry(struct mlx4_dev *dev, u8 vep_num, u8 port,
184184
out_alloc:
185185
if (dqp) {
186186
list_del(&dqp->list);
187-
kfree(&dqp);
187+
kfree(dqp);
188188
}
189189
list_del(&new_entry->list);
190190
kfree(new_entry);

0 commit comments

Comments
 (0)