lkml.org 
[lkml]   [2011]   [Mar]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] [114/275] ocfs2_connection_find() returns pointer to bad structure
Date
2.6.35-longterm review patch.  If anyone has any objections, please let me know.

------------------
From: dann frazier <dann.frazier@canonical.com>

commit 226291aa4641fa13cb5dec3bcb3379faa83009e2 upstream.

If ocfs2_live_connection_list is empty, ocfs2_connection_find() will return
a pointer to the LIST_HEAD, cast as a ocfs2_live_connection. This can cause
an oops when ocfs2_control_send_down() dereferences c->oc_conn:

Call Trace:
[<ffffffffa00c2a3c>] ocfs2_control_message+0x28c/0x2b0 [ocfs2_stack_user]
[<ffffffffa00c2a95>] ocfs2_control_write+0x35/0xb0 [ocfs2_stack_user]
[<ffffffff81143a88>] vfs_write+0xb8/0x1a0
[<ffffffff8155cc13>] ? do_page_fault+0x153/0x3b0
[<ffffffff811442f1>] sys_write+0x51/0x80
[<ffffffff810121b2>] system_call_fastpath+0x16/0x1b

Fix by explicitly returning NULL if no match is found.

Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Andi Kleen <ak@linux.intel.com>

---
fs/ocfs2/stack_user.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/fs/ocfs2/stack_user.c
===================================================================
--- linux-2.6.35.y.orig/fs/ocfs2/stack_user.c 2011-03-29 22:51:23.042133577 -0700
+++ linux-2.6.35.y/fs/ocfs2/stack_user.c 2011-03-29 23:03:00.557285910 -0700
@@ -191,7 +191,7 @@
return c;
}

- return c;
+ return NULL;
}

/*

\
 
 \ /
  Last update: 2011-03-30 23:49    [W:1.960 / U:0.868 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site