From c0291a05f8e6a72c9807b0e2a369ee82bec659c3 Mon Sep 17 00:00:00 2001 From: Eugene Teo Date: Sat, 25 Mar 2006 03:07:27 -0800 Subject: [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 --- fs/9p/vfs_inode.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'fs/9p/vfs_inode.c') diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index dc67f83d0dae..4cbfb714c6e4 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)); -- cgit v1.2.1