Skip to content

Commit 46c23d7

Browse files
lkundraktorvalds
authored andcommitted
sysvfs: fix NULL deref. when allocating new inode
A call to sysv_write_inode() in sysv_new_inode() to its new interface that replaced wait flag with writeback structure. This was broken by a9185b4 ("pass writeback_control to ->write_inode"). Signed-off-by: Lubomir Rintel <lkundrak@v3.sk> Cc: Christoph Hellwig <hch@infradead.org> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: <stable@kernel.org> [2.6.34.x] Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 926b1e2 commit 46c23d7

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎fs/sysv/ialloc.c‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <linux/stat.h>
2626
#include <linux/string.h>
2727
#include <linux/buffer_head.h>
28+
#include <linux/writeback.h>
2829
#include "sysv.h"
2930

3031
/* We don't trust the value of
@@ -139,6 +140,9 @@ struct inode * sysv_new_inode(const struct inode * dir, mode_t mode)
139140
struct inode *inode;
140141
sysv_ino_t ino;
141142
unsigned count;
143+
struct writeback_control wbc = {
144+
.sync_mode = WB_SYNC_NONE
145+
};
142146

143147
inode = new_inode(sb);
144148
if (!inode)
@@ -168,7 +172,7 @@ struct inode * sysv_new_inode(const struct inode * dir, mode_t mode)
168172
insert_inode_hash(inode);
169173
mark_inode_dirty(inode);
170174

171-
sysv_write_inode(inode, 0); /* ensure inode not allocated again */
175+
sysv_write_inode(inode, &wbc); /* ensure inode not allocated again */
172176
mark_inode_dirty(inode); /* cleared by sysv_write_inode() */
173177
/* That's it. */
174178
unlock_super(sb);

0 commit comments

Comments
 (0)