public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 ./WHATS_NEW ./WHATS_NEW_DM lib/device/dev ...
@ 2012-03-04 17:41 zkabelac
  0 siblings, 0 replies; 2+ messages in thread
From: zkabelac @ 2012-03-04 17:41 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2012-03-04 17:40:59

Modified files:
	.              : WHATS_NEW WHATS_NEW_DM 
	lib/device     : dev-cache.c 

Log message:
	Validate udev structures
	
	Avoid using NULL pointers from udev. It seems like some older versions of udev
	were improperly returning NULL in some case, so do not silently break here,
	and give at least a warning to the user.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2340&r2=1.2341
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.585&r2=1.586
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/dev-cache.c.diff?cvsroot=lvm2&r1=1.72&r2=1.73

--- LVM2/WHATS_NEW	2012/03/04 17:36:23	1.2340
+++ LVM2/WHATS_NEW	2012/03/04 17:40:59	1.2341
@@ -1,6 +1,6 @@
 Version 2.02.95 -
 ================================
-  Deactivation of failed thin check on thin pool returns success.
+  Validate udev structures in _insert_udev_dir().
   Scan all devices for lvmetad if 'pvscan --cache' used without device list.
   Populate lvmcache from lvmetad before displaying PVs in pvscan. (2.02.94)
   Suppress incorrect -n pvscan warning now always displayed. (2.02.94)
--- LVM2/WHATS_NEW_DM	2012/03/03 02:08:37	1.585
+++ LVM2/WHATS_NEW_DM	2012/03/04 17:40:59	1.586
@@ -1,5 +1,6 @@
 Version 1.02.74 - 
 ================================
+  Deactivation of failed thin check on thin pool returns success.
 
 Version 1.02.73 - 3rd March 2012
 ================================
--- LVM2/lib/device/dev-cache.c	2012/02/23 13:11:09	1.72
+++ LVM2/lib/device/dev-cache.c	2012/03/04 17:40:59	1.73
@@ -509,14 +509,21 @@
 		goto bad;
 
 	udev_list_entry_foreach(device_entry, udev_enumerate_get_list_entry(udev_enum)) {
-		device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(device_entry));
+		if (!(device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(device_entry)))) {
+			log_warn("Udev returns NULL device.");
+			continue;
+		}
 
-		node_name = udev_device_get_devnode(device);
-		r &= _insert(node_name, 0, 0);
+		if (!(node_name = udev_device_get_devnode(device)))
+			log_warn("Udev returns NULL devnode.");
+		else
+			r &= _insert(node_name, 0, 0);
 
 		udev_list_entry_foreach(symlink_entry, udev_device_get_devlinks_list_entry(device)) {
-			symlink_name = udev_list_entry_get_name(symlink_entry);
-			r &= _insert(symlink_name, 0, 0);
+			if (!(symlink_name = udev_list_entry_get_name(symlink_entry)))
+				log_warn("Udev returns NULL name.");
+			else
+				r &= _insert(symlink_name, 0, 0);
 		}
 
 		udev_device_unref(device);


^ permalink raw reply	[flat|nested] 2+ messages in thread
* LVM2 ./WHATS_NEW ./WHATS_NEW_DM lib/device/dev ...
@ 2012-02-08 11:05 zkabelac
  0 siblings, 0 replies; 2+ messages in thread
From: zkabelac @ 2012-02-08 11:05 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2012-02-08 11:05:05

Modified files:
	.              : WHATS_NEW WHATS_NEW_DM 
	lib/device     : dev-cache.c 
	lib/locking    : locking.c 
	lib/log        : log.c 
	lib/misc       : lvm-globals.c sharedlib.c 
	libdm          : libdm-common.c 
	tools          : dmsetup.c 

Log message:
	Ensure strncpy() function always ends with '\0'
	
	Since last character needs to be \0 for string,
	pass buffer size smaller by 1 byte.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2262&r2=1.2263
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.538&r2=1.539
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/dev-cache.c.diff?cvsroot=lvm2&r1=1.70&r2=1.71
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.102&r2=1.103
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/log/log.c.diff?cvsroot=lvm2&r1=1.66&r2=1.67
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/lvm-globals.c.diff?cvsroot=lvm2&r1=1.15&r2=1.16
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/sharedlib.c.diff?cvsroot=lvm2&r1=1.16&r2=1.17
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.134&r2=1.135
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/dmsetup.c.diff?cvsroot=lvm2&r1=1.173&r2=1.174

--- LVM2/WHATS_NEW	2012/02/08 10:56:17	1.2262
+++ LVM2/WHATS_NEW	2012/02/08 11:05:04	1.2263
@@ -1,5 +1,6 @@
 Version 2.02.91 -
 ===================================
+  Ensure strncpy() function always ends with '\0'.
   Set status in _fsadm_cmd() for error path.
   Add missing deps for lvm2api for rebuild when lvm-internal is changed.
   Fix resource leaks for failing allocation of formats (lvm1/2,pool).
--- LVM2/WHATS_NEW_DM	2012/02/01 18:46:57	1.538
+++ LVM2/WHATS_NEW_DM	2012/02/08 11:05:04	1.539
@@ -1,5 +1,6 @@
 Version 1.02.70 - 
 ===================================
+  Leave space for '\0' for readline() call in _sysfs_get_kernel_name().
 
 Version 1.02.69 - 1st February 2012
 ===================================
--- LVM2/lib/device/dev-cache.c	2012/01/20 11:01:56	1.70
+++ LVM2/lib/device/dev-cache.c	2012/02/08 11:05:04	1.71
@@ -254,8 +254,10 @@
 	if (slash1 < slash0)
 		return 1;
 
-	strncpy(p0, path0, PATH_MAX);
-	strncpy(p1, path1, PATH_MAX);
+	strncpy(p0, path0, sizeof(p0) - 1);
+	p0[sizeof(p0) - 1] = '\0';
+	strncpy(p1, path1, sizeof(p1) - 1);
+	p1[sizeof(p1) - 1] = '\0';
 	s0 = p0 + 1;
 	s1 = p1 + 1;
 
--- LVM2/lib/locking/locking.c	2012/01/21 05:29:52	1.102
+++ LVM2/lib/locking/locking.c	2012/02/08 11:05:04	1.103
@@ -459,7 +459,8 @@
 		return 0;
 	}
 
-	strncpy(resource, vol, sizeof(resource));
+	strncpy(resource, vol, sizeof(resource) - 1);
+	resource[sizeof(resource) - 1] = '\0';
 
 	if (!_lock_vol(cmd, resource, flags, lv_op))
 		return_0;
--- LVM2/lib/log/log.c	2011/10/22 16:52:00	1.66
+++ LVM2/lib/log/log.c	2012/02/08 11:05:04	1.67
@@ -136,7 +136,7 @@
 
 void init_msg_prefix(const char *prefix)
 {
-	strncpy(_msg_prefix, prefix, sizeof(_msg_prefix));
+	strncpy(_msg_prefix, prefix, sizeof(_msg_prefix) - 1);
 	_msg_prefix[sizeof(_msg_prefix) - 1] = '\0';
 }
 
--- LVM2/lib/misc/lvm-globals.c	2011/09/22 17:39:57	1.15
+++ LVM2/lib/misc/lvm-globals.c	2012/02/08 11:05:04	1.16
@@ -165,13 +165,13 @@
 
 void set_cmd_name(const char *cmd)
 {
-	strncpy(_cmd_name, cmd, sizeof(_cmd_name));
+	strncpy(_cmd_name, cmd, sizeof(_cmd_name) - 1);
 	_cmd_name[sizeof(_cmd_name) - 1] = '\0';
 }
 
 void set_sysfs_dir_path(const char *path)
 {
-	strncpy(_sysfs_dir_path, path, sizeof(_sysfs_dir_path));
+	strncpy(_sysfs_dir_path, path, sizeof(_sysfs_dir_path) - 1);
 	_sysfs_dir_path[sizeof(_sysfs_dir_path) - 1] = '\0';
 }
 
--- LVM2/lib/misc/sharedlib.c	2008/12/18 05:27:18	1.16
+++ LVM2/lib/misc/sharedlib.c	2012/02/08 11:05:04	1.17
@@ -34,8 +34,10 @@
 	if (libname[0] == '/' ||
 	    !(lib_dir = find_config_tree_str(cmd, "global/library_dir", 0)) ||
 	    (dm_snprintf(path, path_len, "%s/%s", lib_dir,
-			  libname) == -1) || stat(path, &info) == -1)
-		strncpy(path, libname, path_len);
+			 libname) == -1) || stat(path, &info) == -1) {
+		strncpy(path, libname, path_len - 1);
+		path[path_len - 1] = '\0';
+	}
 }
 
 void *load_shared_library(struct cmd_context *cmd, const char *libname,
--- LVM2/libdm/libdm-common.c	2012/01/25 21:47:18	1.134
+++ LVM2/libdm/libdm-common.c	2012/02/08 11:05:05	1.135
@@ -706,7 +706,7 @@
 
 		if ((fd = open(_path0, O_RDONLY, 0)) != -1) {
 			/* Reading from sysfs, expecting number\n */
-			if ((len = read(fd, buf, sizeof(buf))) < 1) {
+			if ((len = read(fd, buf, sizeof(buf) - 1)) < 1) {
 				log_sys_error("read", _path0);
 				r = 0;
 			} else {
@@ -1256,7 +1256,7 @@
 		goto error;
 	}
 
-	if ((size = readlink(sysfs_path, temp_buf, PATH_MAX)) < 0) {
+	if ((size = readlink(sysfs_path, temp_buf, PATH_MAX - 1)) < 0) {
 		if (errno != ENOENT)
 			log_sys_error("readlink", sysfs_path);
 		else
--- LVM2/tools/dmsetup.c	2012/01/20 10:58:17	1.173
+++ LVM2/tools/dmsetup.c	2012/02/08 11:05:05	1.174
@@ -3059,7 +3059,8 @@
 		    device[strlen(dev_dir)] != '/')
 			goto error;
 
-		strncpy(buf, strrchr(device, '/') + 1, (size_t) PATH_MAX);
+		strncpy(buf, strrchr(device, '/') + 1, PATH_MAX - 1);
+		buf[PATH_MAX - 1] = '\0';
 		dm_free(device);
 
 	} else {


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

end of thread, other threads:[~2012-03-04 17:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-04 17:41 LVM2 ./WHATS_NEW ./WHATS_NEW_DM lib/device/dev zkabelac
  -- strict thread matches above, loose matches on Subject: below --
2012-02-08 11:05 zkabelac

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).