projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c517d83
)
nbd: fix possible memory leak
author
Sudip Mukherjee
<
[email protected]
>
Tue, 27 Jan 2015 12:38:22 +0000
(18:08 +0530)
committer
Markus Pargmann
<
[email protected]
>
Thu, 5 Mar 2015 07:51:03 +0000
(08:51 +0100)
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 <
[email protected]
>
Acked-by: Paul Clements <
[email protected]
>
Cc: <
[email protected]
>
Signed-off-by: Markus Pargmann <
[email protected]
>
drivers/block/nbd.c
patch
|
blob
|
history
diff --git
a/drivers/block/nbd.c
b/drivers/block/nbd.c
index 4bc2a5cb9935fbc6f5256102bdf9c2c24b9e6d8c..a98c41f72c63f4ceac0cef519f12a7b1b5be7702 100644
(file)
--- 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)