mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-22 17:35:59 +03:00
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.
This commit is contained in:
parent
4600444786
commit
913a0dbb3a
@ -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)
|
||||
|
@ -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
|
||||
================================
|
||||
|
@ -509,14 +509,21 @@ static int _insert_udev_dir(struct udev *udev, const char *dir)
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user