linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] udevadm: update prev properly
@ 2011-02-15  9:59 Kei Tokunaga
  2011-02-15 21:31 ` Kay Sievers
  0 siblings, 1 reply; 2+ messages in thread
From: Kei Tokunaga @ 2011-02-15  9:59 UTC (permalink / raw)
  To: linux-hotplug



Hi,

When I tried to boot a system with 256 disks x 4 paths with 
device-mapper, udevadm trigger (--typeÞvices) 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.  I think something like this patch may be needed.

Signed-off-by: Kei Tokunaga <tokunaga.keiich@jp.fujitsu.com>
---

 udev-166-kei/libudev/libudev-enumerate.c |    3 +++
 1 file changed, 3 insertions(+)

diff -puN libudev/libudev-enumerate.c~fix-prev-segfault libudev/libudev-enumerate.c
--- udev-166/libudev/libudev-enumerate.c~fix-prev-segfault	2011-02-15 13:40:23.000000000 +0900
+++ udev-166-kei/libudev/libudev-enumerate.c	2011-02-15 13:40:23.000000000 +0900
@@ -274,6 +274,9 @@ struct udev_list_entry *udev_enumerate_g
 			/* 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;
 			}
 

_




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] udevadm: update prev properly
  2011-02-15  9:59 [PATCH] udevadm: update prev properly Kei Tokunaga
@ 2011-02-15 21:31 ` Kay Sievers
  0 siblings, 0 replies; 2+ messages in thread
From: Kay Sievers @ 2011-02-15 21:31 UTC (permalink / raw)
  To: linux-hotplug

On Tue, Feb 15, 2011 at 10:59, Kei Tokunaga
<tokunaga.keiich@jp.fujitsu.com> wrote:
> When I tried to boot a system with 256 disks x 4 paths with
> device-mapper, udevadm trigger (--typeÞvices) 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.  I think something like this patch may be needed.

Applied.

Thanks,
Kay

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-02-15 21:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-15  9:59 [PATCH] udevadm: update prev properly Kei Tokunaga
2011-02-15 21:31 ` Kay Sievers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).