]> sourceware.org Git - lvm2.git/commitdiff
Skip add_dev_node when ioctls disabled.
authorAlasdair Kergon <agk@redhat.com>
Wed, 21 May 2008 16:14:46 +0000 (16:14 +0000)
committerAlasdair Kergon <agk@redhat.com>
Wed, 21 May 2008 16:14:46 +0000 (16:14 +0000)
Make dm_hash_iter safe against deletion.
Accept a NULL pointer to dm_free silently.

WHATS_NEW_DM
libdm/datastruct/hash.c
libdm/ioctl/libdm-iface.c
libdm/mm/dbg_malloc.h

index 824b19fb7d0a1b5f9a6038f6c44d56b66d3c74bb..cf5cc22eb703c5a4792f73c7b4b44f928edcfce4 100644 (file)
@@ -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.
index 8f0b82f9ce1e162ad82849dd2b4a0510572448ce..8fd3e60c986c4064626c4a17aa3103de13eda077 100644 (file)
@@ -215,12 +215,14 @@ unsigned dm_hash_get_num_entries(struct dm_hash_table *t)
 
 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)
index 26427ba453de7bb7d428100c0a9e64de6880ae89..fb54665cd345349e17a2da9b15d17901f6916c12 100644 (file)
@@ -1690,8 +1690,10 @@ repeat_ioctl:
 
        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:
index 698687180f6be6ede0909894106ac00c86993dcc..6de1020a157fc20ce861b90a33e5b44295fdda6b 100644 (file)
@@ -36,7 +36,7 @@ void bounds_check(void);
 
 #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()
This page took 0.039704 seconds and 5 git commands to generate.