* [PATCH -mm] sysfs: Fix oops in sysfs_drop_dentry on x86_64
@ 2007-06-13 13:36 Rafael J. Wysocki
2007-06-13 13:43 ` Tejun Heo
0 siblings, 1 reply; 2+ messages in thread
From: Rafael J. Wysocki @ 2007-06-13 13:36 UTC (permalink / raw)
To: Andrew Morton; +Cc: Tejun Heo, Greg KH, LKML
From: Rafael J. Wysocki <rjw@sisk.pl>
Fix oops on x86_64 caused by the dereference of dir in sysfs_drop_dentry() made
before checking if dir is not NULL
(cf. http://marc.info/?l=linux-kernel&m=118151626704924&w=2).
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
fs/sysfs/inode.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Index: linux-2.6.22-rc4-mm2/fs/sysfs/inode.c
===================================================================
--- linux-2.6.22-rc4-mm2.orig/fs/sysfs/inode.c
+++ linux-2.6.22-rc4-mm2/fs/sysfs/inode.c
@@ -285,7 +285,7 @@ void sysfs_drop_dentry(struct sysfs_dire
int sysfs_hash_and_remove(struct dentry * dir, const char * name)
{
struct sysfs_dirent **pos, *sd;
- struct sysfs_dirent *parent_sd = dir->d_fsdata;
+ struct sysfs_dirent *parent_sd;
int found = 0;
if (!dir)
@@ -295,6 +295,7 @@ int sysfs_hash_and_remove(struct dentry
/* no inode means this hasn't been made visible yet */
return -ENOENT;
+ parent_sd = dir->d_fsdata;
mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT);
for (pos = &parent_sd->s_children; *pos; pos = &(*pos)->s_sibling) {
sd = *pos;
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH -mm] sysfs: Fix oops in sysfs_drop_dentry on x86_64
2007-06-13 13:36 [PATCH -mm] sysfs: Fix oops in sysfs_drop_dentry on x86_64 Rafael J. Wysocki
@ 2007-06-13 13:43 ` Tejun Heo
0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2007-06-13 13:43 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: Andrew Morton, Greg KH, LKML
Hello, Rafael.
Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@sisk.pl>
>
> Fix oops on x86_64 caused by the dereference of dir in sysfs_drop_dentry() made
> before checking if dir is not NULL
> (cf. http://marc.info/?l=linux-kernel&m=118151626704924&w=2).
>
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> ---
> fs/sysfs/inode.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> Index: linux-2.6.22-rc4-mm2/fs/sysfs/inode.c
> ===================================================================
> --- linux-2.6.22-rc4-mm2.orig/fs/sysfs/inode.c
> +++ linux-2.6.22-rc4-mm2/fs/sysfs/inode.c
> @@ -285,7 +285,7 @@ void sysfs_drop_dentry(struct sysfs_dire
> int sysfs_hash_and_remove(struct dentry * dir, const char * name)
> {
> struct sysfs_dirent **pos, *sd;
> - struct sysfs_dirent *parent_sd = dir->d_fsdata;
> + struct sysfs_dirent *parent_sd;
> int found = 0;
Argh... Right. My delusional mind somehow thought the nonsense early
dereferencing was there before any changes so I passed on that one.
Thanks a lot for catching it. The whole sysfs patchset is pending
regeneration. I'll include the fix patch.
Thanks a lot. :-)
--
tejun
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-06-13 13:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-13 13:36 [PATCH -mm] sysfs: Fix oops in sysfs_drop_dentry on x86_64 Rafael J. Wysocki
2007-06-13 13:43 ` Tejun Heo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.