lkml.org 
[lkml]   [2013]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] Fix null pointer dereference caused by sysfs_notify on binary attribute
Date
It would be nice to have this work as expected but for now this is a minimal
fix to prevent the kernel panic.

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
---
fs/sysfs/file.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 602f56d..976819b 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -449,10 +449,12 @@ void sysfs_notify_dirent(struct sysfs_dirent *sd)

spin_lock_irqsave(&sysfs_open_dirent_lock, flags);

- od = sd->s_attr.open;
- if (od) {
- atomic_inc(&od->event);
- wake_up_interruptible(&od->poll);
+ if (sd->s_attr) {
+ od = sd->s_attr.open;
+ if (od) {
+ atomic_inc(&od->event);
+ wake_up_interruptible(&od->poll);
+ }
}

spin_unlock_irqrestore(&sysfs_open_dirent_lock, flags);
--
1.7.10.4


\
 
 \ /
  Last update: 2013-06-06 12:21    [W:0.049 / U:20.524 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site