Commit c0291a05 authored by Eugene Teo's avatar Eugene Teo Committed by Linus Torvalds

[PATCH] v9fs: fix vfs_inode dereference before NULL check

__getname, which in turn will call kmem_cache_alloc, may return NULL.

Coverity bug #977
Signed-off-by: default avatarEugene Teo <eugene.teo@eugeneteo.net>
Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 16cce6d2
...@@ -1244,6 +1244,8 @@ v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) ...@@ -1244,6 +1244,8 @@ v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
return -EINVAL; return -EINVAL;
name = __getname(); name = __getname();
if (!name)
return -ENOMEM;
/* build extension */ /* build extension */
if (S_ISBLK(mode)) if (S_ISBLK(mode))
sprintf(name, "b %u %u", MAJOR(rdev), MINOR(rdev)); sprintf(name, "b %u %u", MAJOR(rdev), MINOR(rdev));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment