Commit 46c23d7f520e315dde86881b38ba92ebdf34ced5

Authored by Lubomir Rintel
Committed by Linus Torvalds
1 parent 926b1e2ca3

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
a9185b41a4f84971b930c519f0c63bd450c4810d ("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>

Showing 1 changed file with 5 additions and 1 deletions Side-by-side Diff

... ... @@ -25,6 +25,7 @@
25 25 #include <linux/stat.h>
26 26 #include <linux/string.h>
27 27 #include <linux/buffer_head.h>
  28 +#include <linux/writeback.h>
28 29 #include "sysv.h"
29 30  
30 31 /* We don't trust the value of
... ... @@ -139,6 +140,9 @@
139 140 struct inode *inode;
140 141 sysv_ino_t ino;
141 142 unsigned count;
  143 + struct writeback_control wbc = {
  144 + .sync_mode = WB_SYNC_NONE
  145 + };
142 146  
143 147 inode = new_inode(sb);
144 148 if (!inode)
... ... @@ -168,7 +172,7 @@
168 172 insert_inode_hash(inode);
169 173 mark_inode_dirty(inode);
170 174  
171   - sysv_write_inode(inode, 0); /* ensure inode not allocated again */
  175 + sysv_write_inode(inode, &wbc); /* ensure inode not allocated again */
172 176 mark_inode_dirty(inode); /* cleared by sysv_write_inode() */
173 177 /* That's it. */
174 178 unlock_super(sb);