Subject: [PATCH] Fix vfs_inode dereference before NULL check
From: Eugene Teo <[email protected]>
Date: 1142478004 +0800
__getname, which in turn will call kmem_cache_alloc, may return NULL.
Coverity bug #977
Signed-off-by: Eugene Teo <[email protected]>
Signed-off-by: Eric Van Hensbergen <[email protected]>
---
fs/9p/vfs_inode.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
f59413fce41e7979075143d1a8b1d0359c4210bf
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 3ad8455..3438e6a 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -1254,6 +1254,8 @@ v9fs_vfs_mknod(struct inode *dir, struct
return -EINVAL;
name = __getname();
+ if (!name)
+ return -EINVAL;
/* build extension */
if (S_ISBLK(mode))
sprintf(name, "b %u %u", MAJOR(rdev), MINOR(rdev));
--
1.1.0