linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kei Tokunaga <tokunaga.keiich@jp.fujitsu.com>
To: linux-hotplug@vger.kernel.org
Subject: [PATCH] udevadm: update prev properly
Date: Tue, 15 Feb 2011 09:59:24 +0000	[thread overview]
Message-ID: <4D5A4E7C.3050207@jp.fujitsu.com> (raw)



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;
 			}
 

_




             reply	other threads:[~2011-02-15  9:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-15  9:59 Kei Tokunaga [this message]
2011-02-15 21:31 ` [PATCH] udevadm: update prev properly Kay Sievers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D5A4E7C.3050207@jp.fujitsu.com \
    --to=tokunaga.keiich@jp.fujitsu.com \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).