2009-01-21 05:20:33

by Greg KH

[permalink] [raw]
Subject: [GIT PATCH] 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()


2009-01-21 05:21:20

by Greg KH

[permalink] [raw]
Subject: [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().

Signed-off-by: Roland Dreier <[email protected]>
Acked-by: Kay Sievers <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/base/core.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 8079afc..55e5309 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -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);
--
1.6.0.4

2009-01-21 05:21:37

by Greg KH

[permalink] [raw]
Subject: [PATCH 2/5] PNP: fix broken pnp lowercasing for acpi module aliases

From: Kay Sievers <[email protected]>

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

Signed-off-by: Bryan Kadzban <[email protected]>
Signed-off-by: Kay Sievers <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
scripts/mod/file2alias.c | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index d4dc222..491b8b1 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -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);
}
}
}
--
1.6.0.4

2009-01-21 05:21:54

by Greg KH

[permalink] [raw]
Subject: [PATCH 3/5] sysfs: fix problems with binary files

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.

Reported-by: Pavel Roskin <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
fs/sysfs/bin.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c
index 66f6e58..f2c478c 100644
--- a/fs/sysfs/bin.c
+++ b/fs/sysfs/bin.c
@@ -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;
--
1.6.0.4

2009-01-21 05:22:22

by Greg KH

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

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.

Reported-by: Toralf Förster <[email protected]>
Signed-off-by: Inaky Perez-Gonzalez <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
include/linux/debugfs.h | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index 23936b1..0f5c33b 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -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)
--
1.6.0.4

2009-01-21 05:22:44

by Greg KH

[permalink] [raw]
Subject: [PATCH 5/5] klist.c: bit 0 in pointer can't be used as flag

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.

Wed, Jan 14, 2009 at 12:11:32AM +0100, Bastien ROUCARIES wrote:
> 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.

Reported-by: Hinko Kocevar <[email protected]
Cc: Bastien ROUCARIES <[email protected]>
Signed-off-by: Jesper Nilsson <[email protected]>
Cc: stable <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
include/linux/klist.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/klist.h b/include/linux/klist.h
index d5a27af..e91a4e5 100644
--- a/include/linux/klist.h
+++ b/include/linux/klist.h
@@ -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), \
--
1.6.0.4

2009-01-22 06:42:19

by Stephen Rothwell

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

Hi Greg,

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.
>
> Reported-by: Toralf Förster <[email protected]>
> Signed-off-by: Inaky Perez-Gonzalez <[email protected]>
> Signed-off-by: Greg Kroah-Hartman <[email protected]>
> ---
> include/linux/debugfs.h | 7 +++++++
> 1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
> index 23936b1..0f5c33b 100644
> --- a/include/linux/debugfs.h
> +++ b/include/linux/debugfs.h
> @@ -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.

--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/


Attachments:
(No filename) (1.34 kB)
(No filename) (197.00 B)
Download all attachments

2009-01-22 18:25:14

by Greg KH

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

On Thu, Jan 22, 2009 at 05:41:52PM +1100, Stephen Rothwell wrote:
> Hi Greg,
>
> 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.
> >
> > Reported-by: Toralf F?rster <[email protected]>
> > Signed-off-by: Inaky Perez-Gonzalez <[email protected]>
> > Signed-off-by: Greg Kroah-Hartman <[email protected]>
> > ---
> > include/linux/debugfs.h | 7 +++++++
> > 1 files changed, 7 insertions(+), 0 deletions(-)
> >
> > diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
> > index 23936b1..0f5c33b 100644
> > --- a/include/linux/debugfs.h
> > +++ b/include/linux/debugfs.h
> > @@ -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.

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

thanks,

greg k-h

2009-01-22 19:53:27

by Inaky Perez-Gonzalez

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

On Thursday 22 January 2009, Greg KH wrote:
> On Thu, Jan 22, 2009 at 05:41:52PM +1100, Stephen Rothwell wrote:
> > Hi Greg,
> >
> > On Tue, 20 Jan 2009 21:19:56 -0800 Greg Kroah-Hartman <[email protected]>
wrote:
>
> snip [...]
>
> > > > @@ -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.
>
> This is now resolved in my tree, sorry about this.

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

--
Inaky