]> err.no Git - linux-2.6/commitdiff
[PATCH] 9pfs: missing result check in v9fs_vfs_readlink() and v9fs_vfs_link()
authorFlorin Malita <fmalita@gmail.com>
Sun, 25 Jun 2006 12:48:31 +0000 (05:48 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sun, 25 Jun 2006 17:01:15 +0000 (10:01 -0700)
__getname() may fail and return NULL (as pointed out by Coverity 437 &
1220).

Signed-off-by: Florin Malita <fmalita@gmail.com>
Acked-by: Eric Van Hensbergen <ericvh@gmail.com>
Cc: <rminnich@lanl.gov>
Cc: Latchesar Ionkov <lucho@ionkov.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/9p/vfs_inode.c

index 2cb87ba4b1c1fa76ab685d213ae6e0f33a53dcf8..8e60dc7ec4a69011ccaf458c69dc6a321bdb6b36 100644 (file)
@@ -1054,6 +1054,9 @@ static int v9fs_vfs_readlink(struct dentry *dentry, char __user * buffer,
        int ret;
        char *link = __getname();
 
+       if (unlikely(!link))
+               return -ENOMEM;
+
        if (buflen > PATH_MAX)
                buflen = PATH_MAX;
 
@@ -1227,6 +1230,9 @@ v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir,
        }
 
        name = __getname();
+       if (unlikely(!name))
+               return -ENOMEM;
+
        sprintf(name, "%d\n", oldfid->fid);
        retval = v9fs_vfs_mkspecial(dir, dentry, V9FS_DMLINK, name);
        __putname(name);