From: Eugene Teo Date: Sat, 25 Mar 2006 11:07:27 +0000 (-0800) Subject: [PATCH] v9fs: fix vfs_inode dereference before NULL check X-Git-Tag: v2.6.17-rc1~809 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c0291a05f8e6a72c9807b0e2a369ee82bec659c3;p=linux-2.6 [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: Eugene Teo Signed-off-by: Eric Van Hensbergen Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index dc67f83d0d..4cbfb714c6 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c @@ -1244,6 +1244,8 @@ v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) return -EINVAL; name = __getname(); + if (!name) + return -ENOMEM; /* build extension */ if (S_ISBLK(mode)) sprintf(name, "b %u %u", MAJOR(rdev), MINOR(rdev));