Skip to contentSkip to conversation

device-mapper ./WHATS_NEW lib/datastruct/hash. ...

PATCH [email protected] 1 participant 1 message May 21, 2008 Device mapper

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/dm
Module name: device-mapper
Changes by: [email protected] 2008-05-21 16:14:46

Modified files:
. : WHATS_NEW
lib/datastruct : hash.c
lib/ioctl : libdm-iface.c
lib/mm : dbg_malloc.h

Log message:
Skip add_dev_node when ioctls disabled. Make dm_hash_iter safe against deletion. Accept a NULL pointer to dm_free silently.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/WHATS_NEW.diff?cvsroot=dm&r1=1.231&r2=1.232
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/datastruct/hash.c.diff?cvsroot=dm&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/ioctl/libdm-iface.c.diff?cvsroot=dm&r1=1.50&r2=1.51
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/mm/dbg_malloc.h.diff?cvsroot=dm&r1=1.4&r2=1.5

WHATS_NEW +3 -0
@@ -1,5 +1,8 @@
 Version 1.02.26 - 
 =================================
+  Skip add_dev_node when ioctls disabled.
+  Make dm_hash_iter safe against deletion.
+  Accept a NULL pointer to dm_free silently.
   Add tables_loaded, readonly and suspended columns to reports.
   Add --prefixes to dmsetup.
   Add field name prefix option to reporting functions.
lib/datastruct/hash.c +4 -2
@@ -215,12 +215,14 @@
 
 void dm_hash_iter(struct dm_hash_table *t, dm_hash_iterate_fn f)
 {
-	struct dm_hash_node *c;
+	struct dm_hash_node *c, *n;
 	unsigned i;
 
 	for (i = 0; i < t->num_slots; i++)
-		for (c = t->slots[i]; c; c = c->next)
+		for (c = t->slots[i]; c; c = n) {
+			n = c->next;
 			f(c->data);
+		}
 }
 
 void dm_hash_wipe(struct dm_hash_table *t)
lib/ioctl/libdm-iface.c +4 -2
@@ -1690,8 +1690,10 @@
 
 	switch (dmt->type) {
 	case DM_DEVICE_CREATE:
-		add_dev_node(dmt->dev_name, MAJOR(dmi->dev), MINOR(dmi->dev),
-			     dmt->uid, dmt->gid, dmt->mode);
+		if (dmt->dev_name && *dmt->dev_name)
+			add_dev_node(dmt->dev_name, MAJOR(dmi->dev),
+				     MINOR(dmi->dev), dmt->uid, dmt->gid,
+				     dmt->mode);
 		break;
 
 	case DM_DEVICE_REMOVE:
lib/mm/dbg_malloc.h +1 -1
@@ -36,7 +36,7 @@
 
 #else
 
-#  define dm_free(p) free(p)
+#  define dm_free(p) do {if (p) free(p); } while (0)
 #  define dbg_realloc(p, s) realloc(p, s)
 #  define dump_memory()
 #  define bounds_check()