diff options
author | Kei Tokunaga <tokunaga.keiich@jp.fujitsu.com> | 2011-02-15 18:59:24 +0900 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2011-02-15 22:28:31 +0100 |
commit | c54b43e2c233e724f840c4f6a0a81bdd549e40bb (patch) | |
tree | 75d001404d4fb865861ee867167db590873a9043 /libudev/libudev-enumerate.c | |
parent | f3f70f8d9ef6a901bf1bdff10008d76e72bb6692 (diff) |
udevadm: enumerate - update prev pointer properly
When I tried to boot a system with 256 disks x 4 paths with
device-mapper, udevadm trigger (--type=devices) that was called
from start_udev ended up dumping a core due to a segmentation
fault.
In udev_enumerate_get_list_entry(), if it finds the devices that
should be delayed, it calls syspath_add(). If realloc() in
syspath_add() allocates the required memory at a different memory
address, referring prev->len afterward causes the segmentation
fault.
Signed-off-by: Kei Tokunaga <tokunaga.keiich@jp.fujitsu.com>
Diffstat (limited to 'libudev/libudev-enumerate.c')
-rw-r--r-- | libudev/libudev-enumerate.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c index e46bc087fa..9694797d35 100644 --- a/libudev/libudev-enumerate.c +++ b/libudev/libudev-enumerate.c @@ -274,6 +274,9 @@ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *ude /* skip to be delayed devices, and add them to the end of the list */ if (devices_delay_end(udev_enumerate->udev, entry->syspath)) { syspath_add(udev_enumerate, entry->syspath); + /* need to update prev here for the case realloc() gives + a different address */ + prev = &udev_enumerate->devices[i]; continue; } |