]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
nfsd: don't allow zero length strings in cache_parse()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 18 Jan 2012 09:56:02 +0000 (12:56 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 2 Apr 2012 16:53:10 +0000 (09:53 -0700)
commit 6d8d17499810479eabd10731179c04b2ca22152f upstream.

There is no point in passing a zero length string here and quite a
few of that cache_parse() implementations will Oops if count is
zero.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/sunrpc/cache.c

index 72ad836e4fe05d7e5d9153918e5d8c1dacecc4a5..4530a912b8b045b950151262804db79caef34fa8 100644 (file)
@@ -828,6 +828,8 @@ static ssize_t cache_do_downcall(char *kaddr, const char __user *buf,
 {
        ssize_t ret;
 
+       if (count == 0)
+               return -EINVAL;
        if (copy_from_user(kaddr, buf, count))
                return -EFAULT;
        kaddr[count] = '\0';