All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] IB: mlx4: Fix mem leaks in ib_link_query_port()
@ 2012-04-11 21:43 ` Jesper Juhl
  0 siblings, 0 replies; 7+ messages in thread
From: Jesper Juhl @ 2012-04-11 21:43 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, 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-IYz4IdjRLj0sV2N9l4h3zg@public.gmane.org>
---
 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-IYz4IdjRLj0sV2N9l4h3zg@public.gmane.org>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH] IB: mlx4: Fix mem leaks in ib_link_query_port()
@ 2012-04-11 21:43 ` Jesper Juhl
  0 siblings, 0 replies; 7+ 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 related	[flat|nested] 7+ messages in thread

* Re: [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
  -1 siblings, 0 replies; 7+ messages in thread
From: Or Gerlitz @ 2012-04-15  7:34 UTC (permalink / raw)
  To: Jesper Juhl, Roland Dreier
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, David S. Miller

On 4/12/2012 12:43 AM, Jesper Juhl wrote:
> 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.

Acked-by: Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Roland, could you push that?

Or.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] IB: mlx4: Fix mem leaks in ib_link_query_port()
@ 2012-04-15  7:34     ` Or Gerlitz
  0 siblings, 0 replies; 7+ messages in thread
From: Or Gerlitz @ 2012-04-15  7:34 UTC (permalink / raw)
  To: Jesper Juhl, Roland Dreier; +Cc: linux-kernel, linux-rdma, David S. Miller

On 4/12/2012 12:43 AM, Jesper Juhl wrote:
> 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.

Acked-by: Or Gerlitz <ogerlitz@mellanox.com>

Roland, could you push that?

Or.

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

* Re: [PATCH] IB: mlx4: Fix mem leaks in ib_link_query_port()
  2012-04-15  7:34     ` Or Gerlitz
  (?)
@ 2012-04-16  5:05     ` Roland Dreier
  2012-04-16  8:20         ` Or Gerlitz
  -1 siblings, 1 reply; 7+ messages in thread
From: Roland Dreier @ 2012-04-16  5:05 UTC (permalink / raw)
  To: Or Gerlitz; +Cc: Jesper Juhl, linux-kernel, linux-rdma, David S. Miller

thanks, applied (looks like a 3.4 regression so I'll send the fix to
Linus with my next batch)

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

* Re: [PATCH] IB: mlx4: Fix mem leaks in ib_link_query_port()
  2012-04-16  5:05     ` Roland Dreier
@ 2012-04-16  8:20         ` Or Gerlitz
  0 siblings, 0 replies; 7+ messages in thread
From: Or Gerlitz @ 2012-04-16  8:20 UTC (permalink / raw)
  To: Roland Dreier; +Cc: Jesper Juhl, linux-kernel, linux-rdma, David S. Miller

On 4/16/2012 8:05 AM, Roland Dreier wrote:
> thanks, applied (looks like a 3.4 regression so I'll send the fix to Linus with my next batch)

not sure to follow on the next branch part, it is a regression 
introduced in 3.4-rc1 so it should be in your fixes branch
and submitted within a batch possibly containing more fixes, isn't that?


Or.

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

* Re: [PATCH] IB: mlx4: Fix mem leaks in ib_link_query_port()
@ 2012-04-16  8:20         ` Or Gerlitz
  0 siblings, 0 replies; 7+ messages in thread
From: Or Gerlitz @ 2012-04-16  8:20 UTC (permalink / raw)
  To: Roland Dreier; +Cc: Jesper Juhl, linux-kernel, linux-rdma, David S. Miller

On 4/16/2012 8:05 AM, Roland Dreier wrote:
> thanks, applied (looks like a 3.4 regression so I'll send the fix to Linus with my next batch)

not sure to follow on the next branch part, it is a regression 
introduced in 3.4-rc1 so it should be in your fixes branch
and submitted within a batch possibly containing more fixes, isn't that?


Or.

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

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

Thread overview: 7+ 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-11 21:43 ` Jesper Juhl
     [not found] ` <alpine.LNX.2.00.1204112340360.2137-h2p7t3/P30RzeRGmFJ5qR7ZzlVVXadcDXqFh9Ls21Oc@public.gmane.org>
2012-04-15  7:34   ` Or Gerlitz
2012-04-15  7:34     ` Or Gerlitz
2012-04-16  5:05     ` Roland Dreier
2012-04-16  8:20       ` Or Gerlitz
2012-04-16  8:20         ` Or Gerlitz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.