summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2012-01-18 12:56:02 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-02 09:53:10 -0700
commitb43188de0cd27787a75c79856e72c649d4ee9035 (patch)
tree2d42fb985b7a6622c06ecdc2a1c0dbb690e2f3d0 /net
parent61d38cd909ad35ff497bf1a84cd57b2baf6d9c49 (diff)
nfsd: don't allow zero length strings in cache_parse()
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>
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/cache.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 72ad836e4fe0..4530a912b8b0 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -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';