tags 432052 +pending
thanks

I found the problem.  It was actually a big blkid_set_tag() which
failed to clear dev->bid_type when it should have.  Thanks for the bug
report; the details you gave were very helpful in figuring out what
was going on.

This is a pretty serious bug, so I'll be doing an upload very quickly
to address this problem.

                                        - Ted

commit 5aa195991dfa4ced7031360445901a68b58bd9a8
Author: Theodore Ts'o <[EMAIL PROTECTED]>
Date:   Sat Jul 7 18:32:26 2007 -0400

    Fix bug which could cause libblkid to loop forever
    
    When revalidating a partition where there is obsolete information in
    /etc/blkid.tab, we end up freeing a the type tag without clearing
    dev->bid_type, causing blkid_verify() to loop forever.
    
    Addresses-Debian-Bug: #432052
    
    Signed-off-by: "Theodore Ts'o" <[EMAIL PROTECTED]>

diff --git a/lib/blkid/tag.c b/lib/blkid/tag.c
index 57277cd..44dd86d 100644
--- a/lib/blkid/tag.c
+++ b/lib/blkid/tag.c
@@ -132,6 +132,7 @@ int blkid_set_tag(blkid_dev dev, const char *name,
 {
        blkid_tag       t = 0, head = 0;
        char            *val = 0;
+       char            **dev_var = 0;
 
        if (!dev || !name)
                return -BLKID_ERR_PARAM;
@@ -139,6 +140,18 @@ int blkid_set_tag(blkid_dev dev, const char *name,
        if (!(val = blkid_strndup(value, vlength)) && value)
                return -BLKID_ERR_MEM;
 
+       /* 
+        * Certain common tags are linked directly to the device struct
+        * We need to know what they are before we do anything else because
+        * the function name parameter might get freed later on.
+        */
+       if (!strcmp(name, "TYPE"))
+               dev_var = &dev->bid_type;
+       else if (!strcmp(name, "LABEL"))
+               dev_var = &dev->bid_label;
+       else if (!strcmp(name, "UUID"))
+               dev_var = &dev->bid_uuid;
+
        t = blkid_find_tag_dev(dev, name);
        if (!value) {
                if (t)
@@ -182,12 +195,8 @@ int blkid_set_tag(blkid_dev dev, const char *name,
        }
        
        /* Link common tags directly to the device struct */
-       if (!strcmp(name, "TYPE"))
-               dev->bid_type = val;
-       else if (!strcmp(name, "LABEL"))
-               dev->bid_label = val;
-       else if (!strcmp(name, "UUID"))
-               dev->bid_uuid = val;
+       if (dev_var)
+               *dev_var = val;
                
        if (dev->bid_cache)
                dev->bid_cache->bic_flags |= BLKID_BIC_FL_CHANGED;


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to