public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iw_cxgb4: Fix an error handling path in 'c4iw_get_dma_mr()'
@ 2018-05-08  5:44 Christophe JAILLET
  2018-05-09 15:09 ` Doug Ledford
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2018-05-08  5:44 UTC (permalink / raw)
  To: swise, dledford, jgg
  Cc: linux-rdma, linux-kernel, kernel-janitors, Christophe JAILLET

The error handling path of 'c4iw_get_dma_mr()' does not free resources
in the correct order.
If an error occures, it can leak 'mhp->wr_waitp'.

Fixes: a3f12da0e99a ("iw_cxgb4: allocate wait object for each memory object")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/infiniband/hw/cxgb4/mem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb4/mem.c
index e90f2fd8dc16..1445918e3239 100644
--- a/drivers/infiniband/hw/cxgb4/mem.c
+++ b/drivers/infiniband/hw/cxgb4/mem.c
@@ -489,10 +489,10 @@ struct ib_mr *c4iw_get_dma_mr(struct ib_pd *pd, int acc)
 err_dereg_mem:
 	dereg_mem(&rhp->rdev, mhp->attr.stag, mhp->attr.pbl_size,
 		  mhp->attr.pbl_addr, mhp->dereg_skb, mhp->wr_waitp);
-err_free_wr_wait:
-	c4iw_put_wr_wait(mhp->wr_waitp);
 err_free_skb:
 	kfree_skb(mhp->dereg_skb);
+err_free_wr_wait:
+	c4iw_put_wr_wait(mhp->wr_waitp);
 err_free_mhp:
 	kfree(mhp);
 	return ERR_PTR(ret);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] iw_cxgb4: Fix an error handling path in 'c4iw_get_dma_mr()'
  2018-05-08  5:44 [PATCH] iw_cxgb4: Fix an error handling path in 'c4iw_get_dma_mr()' Christophe JAILLET
@ 2018-05-09 15:09 ` Doug Ledford
  0 siblings, 0 replies; 2+ messages in thread
From: Doug Ledford @ 2018-05-09 15:09 UTC (permalink / raw)
  To: Christophe JAILLET, swise, jgg; +Cc: linux-rdma, linux-kernel, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 546 bytes --]

On Tue, 2018-05-08 at 07:44 +0200, Christophe JAILLET wrote:
> The error handling path of 'c4iw_get_dma_mr()' does not free resources
> in the correct order.
> If an error occures, it can leak 'mhp->wr_waitp'.
> 
> Fixes: a3f12da0e99a ("iw_cxgb4: allocate wait object for each memory object")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Applied to for-rc, thanks.

-- 
Doug Ledford <dledford@redhat.com>
    GPG KeyID: B826A3330E572FDD
    Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-05-09 15:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-08  5:44 [PATCH] iw_cxgb4: Fix an error handling path in 'c4iw_get_dma_mr()' Christophe JAILLET
2018-05-09 15:09 ` Doug Ledford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox