Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1414201 > unrolled thread

[PATCH 2/2] IB/sysfs: fix memory leak

Started bySudip Mukherjee <sudipm.mukherjee@gmail.com>
First post2016-06-05 22:20 +0200
Last post2016-06-07 14:00 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/2] IB/sysfs: fix memory leak Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2016-06-05 22:20 +0200
    Re: [PATCH 2/2] IB/sysfs: fix memory leak Leon Romanovsky <leon@kernel.org> - 2016-06-06 08:40 +0200
      Re: [PATCH 2/2] IB/sysfs: fix memory leak Leon Romanovsky <leon@kernel.org> - 2016-06-06 14:20 +0200
    Re: [PATCH 2/2] IB/sysfs: fix memory leak Doug Ledford <dledford@redhat.com> - 2016-06-07 14:00 +0200

#1414201 — [PATCH 2/2] IB/sysfs: fix memory leak

FromSudip Mukherjee <sudipm.mukherjee@gmail.com>
Date2016-06-05 22:20 +0200
Subject[PATCH 2/2] IB/sysfs: fix memory leak
Message-ID<rGMGB-2Yp-1@gated-at.bofh.it>
If the allocation of hsag fails we were just returning but stats was
not released.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
---
 drivers/infiniband/core/sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index fcf6f9c..8d8732c 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -906,7 +906,7 @@ static void setup_hw_stats(struct ib_device *device, struct ib_port *port,
 		       sizeof(void *) * (stats->num_counters + 1),
 		       GFP_KERNEL);
 	if (!hsag)
-		return;
+		goto err;
 
 	ret = device->get_hw_stats(device, stats, port_num,
 				   stats->num_counters);
-- 
1.9.1

[toc] | [next] | [standalone]


#1414673

FromLeon Romanovsky <leon@kernel.org>
Date2016-06-06 08:40 +0200
Message-ID<rGWmC-1e8-15@gated-at.bofh.it>
In reply to#1414201

[Multipart message — attachments visible in raw view] — view raw

On Sun, Jun 05, 2016 at 09:13:56PM +0100, Sudip Mukherjee wrote:
> If the allocation of hsag fails we were just returning but stats was
> not released.
> 
> Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>

Thanks,
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>

> ---
>  drivers/infiniband/core/sysfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
> index fcf6f9c..8d8732c 100644
> --- a/drivers/infiniband/core/sysfs.c
> +++ b/drivers/infiniband/core/sysfs.c
> @@ -906,7 +906,7 @@ static void setup_hw_stats(struct ib_device *device, struct ib_port *port,
>  		       sizeof(void *) * (stats->num_counters + 1),
>  		       GFP_KERNEL);
>  	if (!hsag)
> -		return;
> +		goto err;
>  
>  	ret = device->get_hw_stats(device, stats, port_num,
>  				   stats->num_counters);
> -- 
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[toc] | [prev] | [next] | [standalone]


#1414972

FromLeon Romanovsky <leon@kernel.org>
Date2016-06-06 14:20 +0200
Message-ID<rH1FD-4Qb-9@gated-at.bofh.it>
In reply to#1414673

[Multipart message — attachments visible in raw view] — view raw

On Mon, Jun 06, 2016 at 09:34:54AM +0300, Leon Romanovsky wrote:
> On Sun, Jun 05, 2016 at 09:13:56PM +0100, Sudip Mukherjee wrote:
> > If the allocation of hsag fails we were just returning but stats was
> > not released.
> > 
> > Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
> 
> Thanks,
> Reviewed-by: Leon Romanovsky <leonro@mellanox.com>

It looks the same as Colin's patch which was sent a week ago.
http://marc.info/?l=linux-kernel&m=146480441931189&w=2

> 
> > ---
> >  drivers/infiniband/core/sysfs.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
> > index fcf6f9c..8d8732c 100644
> > --- a/drivers/infiniband/core/sysfs.c
> > +++ b/drivers/infiniband/core/sysfs.c
> > @@ -906,7 +906,7 @@ static void setup_hw_stats(struct ib_device *device, struct ib_port *port,
> >  		       sizeof(void *) * (stats->num_counters + 1),
> >  		       GFP_KERNEL);
> >  	if (!hsag)
> > -		return;
> > +		goto err;
> >  
> >  	ret = device->get_hw_stats(device, stats, port_num,
> >  				   stats->num_counters);
> > -- 
> > 1.9.1
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html


[toc] | [prev] | [next] | [standalone]


#1416090

FromDoug Ledford <dledford@redhat.com>
Date2016-06-07 14:00 +0200
Message-ID<rHnPR-2e7-51@gated-at.bofh.it>
In reply to#1414201

[Multipart message — attachments visible in raw view] — view raw

On 6/5/2016 4:13 PM, Sudip Mukherjee wrote:
> If the allocation of hsag fails we were just returning but stats was
> not released.
> 
> Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
> ---
>  drivers/infiniband/core/sysfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
> index fcf6f9c..8d8732c 100644
> --- a/drivers/infiniband/core/sysfs.c
> +++ b/drivers/infiniband/core/sysfs.c
> @@ -906,7 +906,7 @@ static void setup_hw_stats(struct ib_device *device, struct ib_port *port,
>  		       sizeof(void *) * (stats->num_counters + 1),
>  		       GFP_KERNEL);
>  	if (!hsag)
> -		return;
> +		goto err;
>  
>  	ret = device->get_hw_stats(device, stats, port_num,
>  				   stats->num_counters);
> 

This issue was previously fixed by another patch and is no longer
applicable.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web