ocfs2: ocfs2_prep_new_orphaned_file() should return ret
authorXiaowei.Hu <[email protected]>
Wed, 12 Jun 2013 21:04:41 +0000 (14:04 -0700)
committerLinus Torvalds <[email protected]>
Wed, 12 Jun 2013 23:29:44 +0000 (16:29 -0700)
If an error occurs, for example an EIO in __ocfs2_prepare_orphan_dir,
ocfs2_prep_new_orphaned_file will release the inode_ac, then when the
caller of ocfs2_prep_new_orphaned_file gets a 0 return, it will refer to
a NULL ocfs2_alloc_context struct in the following functions.  A kernel
panic happens.

Signed-off-by: "Xiaowei.Hu" <[email protected]>
Reviewed-by: shencanquan <[email protected]>
Acked-by: Sunil Mushran <[email protected]>
Cc: Joe Jin <[email protected]>
Cc: Mark Fasheh <[email protected]>
Cc: Joel Becker <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
fs/ocfs2/namei.c

index 04ee1b57c243f01a54e59f4405e282e7c633d575..b563351753f1963932b943ff961472af453be2af 100644 (file)
@@ -2216,7 +2216,7 @@ out:
 
        brelse(orphan_dir_bh);
 
-       return 0;
+       return ret;
 }
 
 int ocfs2_create_inode_in_orphan(struct inode *dir,