mirror of https://github.com/vitalif/e2fsprogs
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" <tytso@mit.edu>bitmap-optimize
parent
73d4f8ccaa
commit
ac7dd696d6
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue