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; 2+ 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] 2+ messages in thread

* [PATCH] nbd: fix possible memory leak
  2015-02-12 13:37 [GIT PULL] NBD fixes Markus Pargmann
@ 2015-02-12 13:37 ` Markus Pargmann
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Pargmann @ 2015-02-12 13:37 UTC (permalink / raw)
  To: Jens Axboe
  Cc: nbd-general, 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	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-12 13:41 UTC | newest]

Thread overview: 2+ 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

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®