[prev in list] [next in list] [prev in thread] [next in thread]
List: dm-devel
Subject: [dm-devel] [dmraid 2/4] Avoid fd leak in remove_device_partitions.
From: neilb () suse ! de
Date: 2009-12-17 5:44:12
Message-ID: 20091217054520.996066834 () suse ! de
[Download RAW message or body]
As this removes partitions for a list of devices, it could leak
a large number of file descriptors.
Reported-by: David Binderman <dcb314@hotmail.com>
From: crrodriguez@opensuse.org
Signed-off-by: NeilBrown <neilb@suse.de>
---
lib/device/partition.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- dmraid-16.orig/lib/device/partition.c
+++ dmraid-16/lib/device/partition.c
@@ -30,12 +30,15 @@ _remove_subset_partitions(struct lib_con
/* There is no way to enumerate partitions */
for (part.pno = 1; part.pno <= 256; part.pno++) {
if (ioctl(fd, BLKPG, &io) < 0 && errno != ENXIO &&
- (part.pno < 16 || errno != EINVAL))
+ (part.pno < 16 || errno != EINVAL)) {
+ close(fd);
LOG_ERR(lc, 0,
"removing part %d from %s: %s\n",
part.pno, rd->di->path,
strerror(errno));
+ }
}
+ close(fd);
}
return 1;
}
--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic