]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
ocfs2_connection_find() returns pointer to bad structure
authordann frazier <dann.frazier@canonical.com>
Thu, 18 Nov 2010 22:03:09 +0000 (15:03 -0700)
committerJoel Becker <joel.becker@oracle.com>
Thu, 18 Nov 2010 23:41:41 +0000 (15:41 -0800)
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>
fs/ocfs2/stack_user.c

index 252e7c82f929c203aca6a294d24b49dd17612cee..a5ebe421195fea3df8d66f2dc3573534a3bc298a 100644 (file)
@@ -190,7 +190,7 @@ static struct ocfs2_live_connection *ocfs2_connection_find(const char *name)
                        return c;
        }
 
-       return c;
+       return NULL;
 }
 
 /*