public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Stekloff <dsteklof@us.ibm.com>
To: azarah@gentoo.org,
	Linux Kernel Mailing Lists <linux-kernel@vger.kernel.org>
Cc: Greg KH <greg@kroah.com>
Subject: Re: scsi_id segfault with udev-009
Date: Wed, 17 Dec 2003 10:17:28 -0800	[thread overview]
Message-ID: <200312171017.28358.dsteklof@us.ibm.com> (raw)
In-Reply-To: <1071682198.5067.17.camel@nosferatu.lan>

On Wednesday 17 December 2003 09:29 am, Martin Schlemmer wrote:
> Hi
>
> Getting this with scsi_id and udev-009:


Hi,

Scsi_id hasn't been changed to use the latest libsysfs changes. The 
"directory" in the sysfs_class_device is now considered "private" and only 
should be accessed using functions. Treating the structures as handles lets 
us only load information when it's needed, reducing caching or stale 
information and also helping performance. 

Here's the problem.

static inline char *sysfs_get_attr(struct sysfs_class_device *dev,
                                    const char *attr)
{
        return sysfs_get_value_from_attributes(dev->directory->attributes,
                                               attr);
}

Please try this quick fix:

--- udev/extras/scsi_id/scsi_id.h	2003-12-08 01:42:46.000000000 -0800
+++ udev-fix/extras/scsi_id/scsi_id.h	2003-12-17 09:52:31.032184768 -0800
@@ -42,8 +42,14 @@
 static inline char *sysfs_get_attr(struct sysfs_class_device *dev,
 				    const char *attr)
 {
-	return sysfs_get_value_from_attributes(dev->directory->attributes,
-					       attr);
+	struct dlist *attributes = NULL;
+
+	attributes = sysfs_get_classdev_attributes(dev);
+
+	if (attributes == NULL)
+		return NULL;
+
+	return sysfs_get_value_from_attributes(attributes, attr);
 }
 
 extern int scsi_get_serial (struct sysfs_class_device *scsi_dev,
--- udev/extras/scsi_id/scsi_id.c	2003-12-08 01:42:46.000000000 -0800
+++ udev-fix/extras/scsi_id/scsi_id.c	2003-12-17 09:55:54.113311744 -0800
@@ -133,7 +133,7 @@
 		return -1;
 
 	snprintf(bus_dev_name, MAX_NAME_LEN, "%s/%s/%s/%s/%s", sysfs_mnt_path,
-		 SYSFS_BUS_DIR, bus, SYSFS_DEVICES_NAME, bus_id);
+		 SYSFS_BUS_NAME, bus, SYSFS_DEVICES_NAME, bus_id);
 
 	if (stat(sysfs_path, &stat_buf))
 		return -1;


  parent reply	other threads:[~2003-12-17 18:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-17 17:29 scsi_id segfault with udev-009 Martin Schlemmer
2003-12-17 18:07 ` Greg KH
2003-12-17 18:17 ` Daniel Stekloff [this message]
2003-12-17 19:40   ` Martin Schlemmer
2003-12-17 19:43     ` Daniel Stekloff
2003-12-17 21:09       ` Martin Schlemmer
2003-12-18  0:36   ` Greg KH

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=200312171017.28358.dsteklof@us.ibm.com \
    --to=dsteklof@us.ibm.com \
    --cc=azarah@gentoo.org \
    --cc=greg@kroah.com \
    --cc=linux-kernel@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