public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PULL v2] NBD fixes
@ 2015-03-05  8:09 Markus Pargmann
  2015-03-05  8:09 ` [PATCH] nbd: fix possible memory leak Markus Pargmann
  2015-03-05 15:05 ` [PULL v2] NBD fixes Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Markus Pargmann @ 2015-03-05  8:09 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-kernel, Markus Pargmann

Hi Jens,

This is essentially a resend of the pull request from last month
(nbd_fixes_20150212).

It includes one NBD patch that fixes a memory leak which occures when a module
parameter has an invalid value.

It is based now based on v4.0-rc1.

Best Regards,

Markus


The following changes since commit c517d838eb7d07bbe9507871fab3931deccff539:

  Linux 4.0-rc1 (2015-02-22 18:21:14 -0800)

are available in the git repository at:

  git://git.pengutronix.de/git/mpa/linux-nbd.git tags/nbd_fixes_20150305

for you to fetch changes up to ff6b8090e26ef7649ef0cc6b42389141ef48b0cf:

  nbd: fix possible memory leak (2015-03-05 08:51:03 +0100)

----------------------------------------------------------------
NBD fixes based on v4.0-rc1

----------------------------------------------------------------
Sudip Mukherjee (1):
      nbd: fix possible memory leak

 drivers/block/nbd.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

-- 
2.1.4


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

* [PATCH] nbd: fix possible memory leak
  2015-03-05  8:09 [PULL v2] NBD fixes Markus Pargmann
@ 2015-03-05  8:09 ` Markus Pargmann
  2015-03-05 15:05 ` [PULL v2] NBD fixes Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Pargmann @ 2015-03-05  8:09 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-kernel, Sudip Mukherjee, Sudip Mukherjee, stable,
	Markus Pargmann

From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>

we have already allocated memory for nbd_dev, but we were not
releasing that memory and just returning the error value.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Acked-by: Paul Clements <Paul.Clements@SteelEye.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 drivers/block/nbd.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 4bc2a5cb9935..a98c41f72c63 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -803,10 +803,6 @@ static int __init nbd_init(void)
 		return -EINVAL;
 	}
 
-	nbd_dev = kcalloc(nbds_max, sizeof(*nbd_dev), GFP_KERNEL);
-	if (!nbd_dev)
-		return -ENOMEM;
-
 	part_shift = 0;
 	if (max_part > 0) {
 		part_shift = fls(max_part);
@@ -828,6 +824,10 @@ static int __init nbd_init(void)
 	if (nbds_max > 1UL << (MINORBITS - part_shift))
 		return -EINVAL;
 
+	nbd_dev = kcalloc(nbds_max, sizeof(*nbd_dev), GFP_KERNEL);
+	if (!nbd_dev)
+		return -ENOMEM;
+
 	for (i = 0; i < nbds_max; i++) {
 		struct gendisk *disk = alloc_disk(1 << part_shift);
 		if (!disk)
-- 
2.1.4


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

* Re: [PULL v2] NBD fixes
  2015-03-05  8:09 [PULL v2] NBD fixes Markus Pargmann
  2015-03-05  8:09 ` [PATCH] nbd: fix possible memory leak Markus Pargmann
@ 2015-03-05 15:05 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2015-03-05 15:05 UTC (permalink / raw)
  To: Markus Pargmann; +Cc: linux-kernel

On 03/05/2015 01:09 AM, Markus Pargmann wrote:
> Hi Jens,
>
> This is essentially a resend of the pull request from last month
> (nbd_fixes_20150212).
>
> It includes one NBD patch that fixes a memory leak which occures when a module
> parameter has an invalid value.
>
> It is based now based on v4.0-rc1.

Pulled, thanks.

-- 
Jens Axboe


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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-05  8:09 [PULL v2] NBD fixes Markus Pargmann
2015-03-05  8:09 ` [PATCH] nbd: fix possible memory leak Markus Pargmann
2015-03-05 15:05 ` [PULL v2] NBD fixes Jens Axboe

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