[Fwd: Re: [ANNOUNCE] udev 026 release]

Ronald Hummelink maillist at hummelink.xs4all.nl
Tue Jun 8 13:08:01 PDT 2004


This patch was send to lkml after the announce of udev 026,
Greg KH posted he applied it.

-------- Original Message --------
Subject: 	Re: [ANNOUNCE] udev 026 release
Date: 	Tue, 8 Jun 2004 11:21:54 +0200
From: 	Alex Riesen <fork0 at users.sourceforge.net>
Reply-To: 	Alex Riesen <fork0 at users.sourceforge.net>
To: 	Greg KH <greg at kroah.com>
CC: 	linux-kernel at vger.kernel.org, 
linux-hotplug-devel at lists.sourceforge.net



There is a handle leak in failure path in file_map, and the result of
file_map (or the result of the caller of the file_map) is not always
checked.

--- udev_lib.c	2004-06-08 11:08:35.812419586 +0200
+++ udev_lib.c	2004-06-08 11:10:53.203654065 +0200
@@ -124,11 +124,13 @@ int file_map(const char *filename, char 
 	}
 
 	if (fstat(fd, &stats) < 0) {
+		close(fd);
 		return -1;
 	}
 
 	*buf = mmap(NULL, stats.st_size, PROT_READ, MAP_SHARED, fd, 0);
 	if (*buf == MAP_FAILED) {
+		close(fd);
 		return -1;
 	}
 	*bufsize = stats.st_size;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/





More information about the lfs-dev mailing list