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)
committerJ. Bruce Fields <bfields@redhat.com>
Fri, 3 Feb 2012 19:26:42 +0000 (14:26 -0500)
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>
Cc: stable@kernel.org
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
net/sunrpc/cache.c

index 465df9ae1046b7fc12fe99fd0759017be7a7dc2a..8c6598e0334a0347ba29909b992a72cd9f126c31 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';