mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] IB: mlx4: Fix mem leaks in ib_link_query_port()
@ 2012-04-11 21:43 Jesper Juhl
  2012-04-15  7:34 ` Or Gerlitz
  0 siblings, 1 reply; 4+ messages in thread
From: Jesper Juhl @ 2012-04-11 21:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-rdma, David S. Miller, Jack Morgenstein, Roland Dreier,
	Hal Rosenstock, Sean Hefty, Or Gerlitz

If, in ib_link_query_port(), the call to mlx4_MAD_IFC() fails we will
currently do 'return err;' which will leak 'in_mad' and 'out_mad' that
we previously allocated. I believe we should instead do 'goto out;'
where we'll properly free the memory we previously allocated.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/infiniband/hw/mlx4/main.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index 75d3056..cc88c9c 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -247,7 +247,7 @@ static int ib_link_query_port(struct ib_device *ibdev, u8 port,
 		err = mlx4_MAD_IFC(to_mdev(ibdev), 1, 1, port,
 				   NULL, NULL, in_mad, out_mad);
 		if (err)
-			return err;
+			goto out;
 
 		/* Checking LinkSpeedActive for FDR-10 */
 		if (out_mad->data[15] & 0x1)
-- 
1.7.10


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


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

end of thread, other threads:[~2012-04-16  8:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-11 21:43 [PATCH] IB: mlx4: Fix mem leaks in ib_link_query_port() Jesper Juhl
2012-04-15  7:34 ` Or Gerlitz
2012-04-16  5:05   ` Roland Dreier
2012-04-16  8:20     ` Or Gerlitz

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

Powered by JetHome