Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Lubomir Rintel and committed by
Linus Torvalds
46c23d7f 926b1e2c

+5 -1
+5 -1
fs/sysv/ialloc.c
··· 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 ··· 140 139 struct inode *inode; 141 140 sysv_ino_t ino; 142 141 unsigned count; 142 + struct writeback_control wbc = { 143 + .sync_mode = WB_SYNC_NONE 144 + }; 143 145 144 146 inode = new_inode(sb); 145 147 if (!inode) ··· 172 168 insert_inode_hash(inode); 173 169 mark_inode_dirty(inode); 174 170 175 - sysv_write_inode(inode, 0); /* ensure inode not allocated again */ 171 + sysv_write_inode(inode, &wbc); /* ensure inode not allocated again */ 176 172 mark_inode_dirty(inode); /* cleared by sysv_write_inode() */ 177 173 /* That's it. */ 178 174 unlock_super(sb);