Skip to contentSkip to conversation

driver core fixes for your 2.6-git tree

PATCH New Greg KH 3 participants 9 messages Jan 21, 2009 – Jan 22, 2009

Subsystems (2)
lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 driver core fixes for your 2.6-git tree

Here are 5 bugfixes against your current kernel git tree.

They fix the following reported problems:
- klist blowing up on CRIS architecture
- some block device names showing up incorrectly due to mishandled ! formatting
- sysfs binary file bugfix
- debugfs build breakage if it is disable and wimax is enabled.
- PNP modules not properly being autoloaded due to lowercase issues in file2alias.c

All of these have been in the last -next release, with the majority of them in the -next releases for the past week.

Please pull from:
master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-core-2.6.git/

The patches will be sent as a follow-on to this message to lkml for people to see.

thanks,

greg k-h

------------

 drivers/base/core.c      |    6 ++++++
 fs/sysfs/bin.c           |    6 ++++++
 include/linux/debugfs.h  |    7 +++++++
 include/linux/klist.h    |    2 +-
 scripts/mod/file2alias.c |   17 +++++++++++++++--
 5 files changed, 35 insertions(+), 3 deletions(-)

---------------

Greg Kroah-Hartman (1):
sysfs: fix problems with binary files

Inaky Perez-Gonzalez (1):
debugfs: introduce stub for debugfs_create_size_t() when DEBUG_FS=n

Jesper Nilsson (1):
klist.c: bit 0 in pointer can't be used as flag

Kay Sievers (1):
PNP: fix broken pnp lowercasing for acpi module aliases

Roland Dreier (1):
driver core: Convert '/' to '!' in dev_set_name()

#1 lore raw

PATCH 1/5 driver core: Convert '/' to '!' in dev_set_name()

From: Roland Dreier <[email protected]>

Commit 3ada8b7e ("block: struct device - replace bus_id with dev_name(), dev_set_name()") deleted the code in register_disk() that changed a '/' to a '!' in the device name when registering a disk, but dev_set_name() does not perform this conversion.

This leads to amusing problems with disks that have '/' in their names:
for example a failure to boot with the root partition on a cciss device, even though the kernel says it knows about the root device:

    VFS: Cannot open root device "cciss/c0d0p6" or unknown-block(0,0)
    Please append a correct "root=" boot option; here are the available partitions:
    6800        71652960 cciss/c0d0 driver: cciss
      6802               1 cciss/c0d0p2
      6805         2931831 cciss/c0d0p5
      6806        34354908 cciss/c0d0p6
    6810        71652960 cciss/c0d1 driver: cciss

Fix this by adding code to change '/' to '!' in dev_set_name() to handle this until dev_set_name() is converted to use kobject_set_name().

---
 drivers/base/core.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/base/core.c +6 -0
index 8079afc..55e5309 100644
@@ -777,10 +777,16 @@ static void device_remove_class_symlinks(struct device *dev)
 int dev_set_name(struct device *dev, const char *fmt, ...)
 {
 	va_list vargs;
+	char *s;
 
 	va_start(vargs, fmt);
 	vsnprintf(dev->bus_id, sizeof(dev->bus_id), fmt, vargs);
 	va_end(vargs);
+
+	/* ewww... some of these buggers have / in the name... */
+	while ((s = strchr(dev->bus_id, '/')))
+		*s = '!';
+
 	return 0;
 }
 EXPORT_SYMBOL_GPL(dev_set_name);
Signature · 1 line
1.6.0.4
#2 lore raw

PATCH 2/5 PNP: fix broken pnp lowercasing for acpi module aliases

In reply to Greg KH

From: Kay Sievers <[email protected]>

Based on a patch from Brian, who identified the issue.

---
 scripts/mod/file2alias.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)
scripts/mod/file2alias.c +15 -2
index d4dc222..491b8b1 100644
@@ -366,11 +366,17 @@ static void do_pnp_device_entry(void *symval, unsigned long size,
 
 	for (i = 0; i < count; i++) {
 		const char *id = (char *)devs[i].id;
+		char acpi_id[sizeof(devs[0].id)];
+		int j;
 
 		buf_printf(&mod->dev_table_buf,
 			   "MODULE_ALIAS(\"pnp:d%s*\");\n", id);
+
+		/* fix broken pnp bus lowercasing */
+		for (j = 0; j < sizeof(acpi_id); j++)
+			acpi_id[j] = toupper(id[j]);
 		buf_printf(&mod->dev_table_buf,
-			   "MODULE_ALIAS(\"acpi*:%s:*\");\n", id);
+			   "MODULE_ALIAS(\"acpi*:%s:*\");\n", acpi_id);
 	}
 }
 
@@ -416,10 +422,17 @@ static void do_pnp_card_entries(void *symval, unsigned long size,
 
 			/* add an individual alias for every device entry */
 			if (!dup) {
+				char acpi_id[sizeof(card->devs[0].id)];
+				int k;
+
 				buf_printf(&mod->dev_table_buf,
 					   "MODULE_ALIAS(\"pnp:d%s*\");\n", id);
+
+				/* fix broken pnp bus lowercasing */
+				for (k = 0; k < sizeof(acpi_id); k++)
+					acpi_id[k] = toupper(id[k]);
 				buf_printf(&mod->dev_table_buf,
-					   "MODULE_ALIAS(\"acpi*:%s:*\");\n", id);
+					   "MODULE_ALIAS(\"acpi*:%s:*\");\n", acpi_id);
 			}
 		}
 	}
Signature · 1 line
1.6.0.4
#3 lore raw

PATCH 3/5 sysfs: fix problems with binary files

In reply to Greg KH

Some sysfs binary files don't like having 0 passed to them as a size. Fix this up at the root by just returning to the vfs if userspace asks us for a zero sized buffer.

Thanks to Pavel Roskin for pointing this out.

---
 fs/sysfs/bin.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
fs/sysfs/bin.c +6 -0
index 66f6e58..f2c478c 100644
@@ -63,6 +63,9 @@ read(struct file *file, char __user *userbuf, size_t bytes, loff_t *off)
 	int count = min_t(size_t, bytes, PAGE_SIZE);
 	char *temp;
 
+	if (!bytes)
+		return 0;
+
 	if (size) {
 		if (offs > size)
 			return 0;
@@ -131,6 +134,9 @@ static ssize_t write(struct file *file, const char __user *userbuf,
 	int count = min_t(size_t, bytes, PAGE_SIZE);
 	char *temp;
 
+	if (!bytes)
+		return 0;
+
 	if (size) {
 		if (offs > size)
 			return 0;
Signature · 1 line
1.6.0.4
#4 lore raw

PATCH 4/5 debugfs: introduce stub for debugfs_create_size_t() when DEBUG_FS=n

In reply to Greg KH

From: Inaky Perez-Gonzalez <[email protected]>

Toralf Förster <[email protected]> reported a build failure in the WiMAX stack when CONFIG_DEBUG_FS=n

http://linuxwimax.org/pipermail/wimax/2009-January/000449.html

This is due to debugfs_create_size_t() missing an stub that returns -ENODEV when the DEBUGFS subsystem is not configured in (like the rest of the debugfs API).

This patch adds said stub.

---
 include/linux/debugfs.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
include/linux/debugfs.h +7 -0
index 23936b1..0f5c33b 100644
@@ -162,6 +162,13 @@ static inline struct dentry *debugfs_create_x32(const char *name, mode_t mode,
 	return ERR_PTR(-ENODEV);
 }
 
+struct dentry *debugfs_create_size_t(const char *name, mode_t mode,
+				     struct dentry *parent,
+				     size_t *value)
+{
+	return ERR_PTR(-ENODEV);
+}
+
 static inline struct dentry *debugfs_create_bool(const char *name, mode_t mode,
 						 struct dentry *parent,
 						 u32 *value)
Signature · 1 line
1.6.0.4
#8 lore raw

PATCH 5/5 klist.c: bit 0 in pointer can't be used as flag

In reply to Greg KH

From: Jesper Nilsson <[email protected]>

The commit a1ed5b0cffe4b16a93a6a3390e8cee0fbef94f86 (klist: don't iterate over deleted entries) introduces use of the low bit in a pointer to indicate if the knode is dead or not, assuming that this bit is always free.

This is not true for all architectures, CRIS for example may align data on byte borders.

The result is a bunch of warnings on bootup, devices not being added correctly etc, reported by Hinko Kocevar <[email protected]>:

------------[ cut here ]------------
WARNING: at lib/klist.c:62 ()
Modules linked in:

Stack from c1fe1cf0:

       c01cc7f4 c1fe1d11 c000eb4e c000e4de 00000000 00000000 c1f4f78f c1f50c2d
       c01d008c c1fdd1a0 c1fdd1a0 c1fe1d38 c0192954 c1fe0000 00000000 c1fe1dc0
       00000002 7fffffff c1fe1da8 c0192d50 c1fe1dc0 00000002 7fffffff c1ff9fcc
Call Trace: [<c000eb4e>] [<c000e4de>] [<c0192954>] [<c0192d50>] [<c001d49e>] [<c000b688>] [<c0192a3c>]
       [<c000b63e>] [<c000b63e>] [<c001a542>] [<c00b55b0>] [<c00411c0>] [<c00b559c>] [<c01918e6>] [<c0191988>]
       [<c01919d0>] [<c00cd9c8>] [<c00cdd6a>] [<c0034178>] [<c000409a>] [<c0015576>] [<c0029130>] [<c0029078>]
       [<c0029170>] [<c0012336>] [<c00b4076>] [<c00b4770>] [<c006d6e4>] [<c006d974>] [<c006dca0>] [<c0028d6c>]
       [<c0028e12>] [<c0006424>] <4>---[ end trace 4eaa2a86a8e2da22 ]---
------------[ cut here ]------------
Repeat ad nauseam.
Quoted 9 lines · Bastien ROUCARIES

Perhaps using a pointerhackalign trick on this structure where #define pointerhackalign(x) __attribute__ ((aligned (x))) and declare
struct klist_node {
...
} pointerhackalign(2);

Because __attribute__ ((aligned (x))) could only increase alignment it will safe to do that and serve as documentation purpose :)

That works, but we need to do it not for the struct klist_node, but for the struct we insert into the void * in klist_node, which is struct klist.

---
 include/linux/klist.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/klist.h +1 -1
index d5a27af..e91a4e5 100644
@@ -22,7 +22,7 @@ struct klist {
 	struct list_head	k_list;
 	void			(*get)(struct klist_node *);
 	void			(*put)(struct klist_node *);
-};
+} __attribute__ ((aligned (4)));
 
 #define KLIST_INIT(_name, _get, _put)					\
 	{ .k_lock	= __SPIN_LOCK_UNLOCKED(_name.k_lock),		\
Signature · 1 line
1.6.0.4
#5 lore raw

Re: [PATCH 4/5] debugfs: introduce stub for debugfs_create_size_t() when DEBUG_FS=n

In reply to Greg Kroah-Hartman

Hi Greg,

Quoted 26 lines · On Tue, 20 Jan 2009 21:19:56 -0800 Greg Kroah-Hartman <[email protected]> wrote:

From: Inaky Perez-Gonzalez <[email protected]>

Toralf Förster <[email protected]> reported a build failure in the WiMAX stack when CONFIG_DEBUG_FS=n

http://linuxwimax.org/pipermail/wimax/2009-January/000449.html

This is due to debugfs_create_size_t() missing an stub that returns -ENODEV when the DEBUGFS subsystem is not configured in (like the rest of the debugfs API).

This patch adds said stub.

---
 include/linux/debugfs.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
include/linux/debugfs.h +0 -0
index 23936b1..0f5c33b 100644

include/linux/debugfs.h static inline struct dentry *debugfs_create_x32(const char *name, mode_t mode, · line 165

Quoted 4 lines
include/linux/debugfs.h +1 -0
@@ -162,6 +162,13 @@ static inline struct dentry *debugfs_create_x32(const char *name, mode_t mode,
 	return ERR_PTR(-ENODEV);
 }
 
+struct dentry *debugfs_create_size_t(const char *name, mode_t mode,

This needs to be "static inline". See my other email about linux-next breakage due to this.

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/
author
#6 lore raw

Re: [PATCH 4/5] debugfs: introduce stub for debugfs_create_size_t() when DEBUG_FS=n

Quoted 32 lines · Stephen Rothwell

Hi Greg,

Quoted 29 lines · On Tue, 20 Jan 2009 21:19:56 -0800 Greg Kroah-Hartman <[email protected]> wrote:

From: Inaky Perez-Gonzalez <[email protected]>

Toralf Förster <[email protected]> reported a build failure in the WiMAX stack when CONFIG_DEBUG_FS=n

http://linuxwimax.org/pipermail/wimax/2009-January/000449.html

This is due to debugfs_create_size_t() missing an stub that returns -ENODEV when the DEBUGFS subsystem is not configured in (like the rest of the debugfs API).

This patch adds said stub.

---
 include/linux/debugfs.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
include/linux/debugfs.h +0 -0
index 23936b1..0f5c33b 100644
@@ -162,6 +162,13 @@ static inline struct dentry *debugfs_create_x32(const char *name, mode_t mode,
 	return ERR_PTR(-ENODEV);
 }
 
Quoted 4 lines

include/linux/debugfs.h static inline struct dentry *debugfs_create_x32(const char *name, mode_t mode, · line 165

Quoted 1 line
include/linux/debugfs.h +1 -0
+struct dentry *debugfs_create_size_t(const char *name, mode_t mode,

This needs to be "static inline". See my other email about linux-next breakage due to this.

This is now resolved in my tree, sorry about this.

thanks,

greg k-h

#7 lore raw

Re: [PATCH 4/5] debugfs: introduce stub for debugfs_create_size_t() when DEBUG_FS=n

Quoted 4 lines · Greg KH
Quoted 3 lines · Stephen Rothwell

Hi Greg,

On Tue, 20 Jan 2009 21:19:56 -0800 Greg Kroah-Hartman <[email protected]>

Quoted 8 lines · wrote:

snip [...]

Quoted 5 lines
Quoted 5 lines

Review static inline struct dentry

Quoted 1 line
(quoted diff) +0 -0
@@ -162,6 +162,13 @@ static inline struct dentry 

*debugfs_create_x32(const char *name, mode_t mode, return ERR_PTR(-ENODEV);
}

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

+struct dentry *debugfs_create_size_t(const char *name, mode_t mode,

This needs to be "static inline". See my other email about linux-next breakage due to this.

This is now resolved in my tree, sorry about this.

Ouch -- that was my fault. Sorry for messing up something so basic.

Signature · 1 line
Inaky