mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [GIT PULL] NBD fixes
@ 2015-02-12 13:37 Markus Pargmann
  2015-02-12 13:37 ` [PATCH] nbd: fix possible memory leak Markus Pargmann
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Pargmann @ 2015-02-12 13:37 UTC (permalink / raw)
  To: Jens Axboe; +Cc: nbd-general, linux-kernel, Markus Pargmann

Hi Jens,

This is a pull request for one NBD patch. It fixes a memory leak which occures
when a module parameter has an invalid value.

It is based on v3.19-rc2. If you prefer a different base please let me know.

Best Regards,

Markus


The following changes since commit b7392d2247cfe6771f95d256374f1a8e6a6f48d6:

  Linux 3.19-rc2 (2014-12-28 16:49:37 -0800)

are available in the git repository at:

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

for you to fetch changes up to 473b3bfe169ca0b2192d7184786429bd75d359da:

  nbd: fix possible memory leak (2015-02-12 13:21:55 +0100)

----------------------------------------------------------------
NBD fixes based on v3.19-rc2

----------------------------------------------------------------
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] 5+ messages in thread
* [PULL v2] NBD fixes
@ 2015-03-05  8:09 Markus Pargmann
  2015-03-05  8:09 ` [PATCH] nbd: fix possible memory leak Markus Pargmann
  0 siblings, 1 reply; 5+ 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] 5+ messages in thread
* [PATCH] nbd: fix possible memory leak
@ 2015-01-13 17:19 Sudip Mukherjee
  2015-01-26 17:00 ` Paul Clements
  0 siblings, 1 reply; 5+ messages in thread
From: Sudip Mukherjee @ 2015-01-13 17:19 UTC (permalink / raw)
  To: Paul Clements; +Cc: Sudip Mukherjee, nbd-general, linux-kernel

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>
---

Hi Paul,
after seeing your mail about maintainers, just started to see the code.
this patch is one way, another way can be to bring the kcalloc part below these checks. 

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

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 4bc2a5c..13ea239 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -822,11 +822,15 @@ static int __init nbd_init(void)
 		max_part = (1UL << part_shift) - 1;
 	}
 
-	if ((1UL << part_shift) > DISK_MAX_PARTS)
-		return -EINVAL;
+	if ((1UL << part_shift) > DISK_MAX_PARTS) {
+		err = -EINVAL;
+		goto out_free;
+	}
 
-	if (nbds_max > 1UL << (MINORBITS - part_shift))
-		return -EINVAL;
+	if (nbds_max > 1UL << (MINORBITS - part_shift)) {
+		err = -EINVAL;
+		goto out_free;
+	}
 
 	for (i = 0; i < nbds_max; i++) {
 		struct gendisk *disk = alloc_disk(1 << part_shift);
@@ -889,6 +893,7 @@ out:
 		blk_cleanup_queue(nbd_dev[i].disk->queue);
 		put_disk(nbd_dev[i].disk);
 	}
+out_free:
 	kfree(nbd_dev);
 	return err;
 }
-- 
1.8.1.2


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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-12 13:37 [GIT PULL] NBD fixes Markus Pargmann
2015-02-12 13:37 ` [PATCH] nbd: fix possible memory leak Markus Pargmann
  -- strict thread matches above, loose matches on Subject: below --
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-01-13 17:19 Sudip Mukherjee
2015-01-26 17:00 ` Paul Clements

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

all inboxes | Powered by JetHome®