[PATCH 4.7 041/141] i40iw: Fix double free of allocated_buffer

From: Greg Kroah-Hartman
Date: Thu Oct 06 2016 - 04:36:48 EST


4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Mustafa Ismail <mustafa.ismail@xxxxxxxxx>

commit d41d0910d97f05be987d2d60de7e8685c108963b upstream.

Memory allocated for iwqp; iwqp->allocated_buffer is freed twice in
the create_qp error path. Correct this by having it freed only once in
i40iw_free_qp_resources().

Fixes: d37498417947 ("i40iw: add files for iwarp interface")

Signed-off-by: Mustafa Ismail <mustafa.ismail@xxxxxxxxx>
Signed-off-by: Shiraz Saleem <shiraz.saleem@xxxxxxxxx>
Signed-off-by: Doug Ledford <dledford@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
drivers/infiniband/hw/i40iw/i40iw_verbs.c | 1 -
1 file changed, 1 deletion(-)

--- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
@@ -794,7 +794,6 @@ static struct ib_qp *i40iw_create_qp(str
return &iwqp->ibqp;
error:
i40iw_free_qp_resources(iwdev, iwqp, qp_num);
- kfree(mem);
return ERR_PTR(err_code);
}