diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2017-04-14 17:22:18 -0400 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2017-07-18 18:40:36 +0100 |
commit | 443b07a45cb71f6ca26d7d99ac19f9f9a46922df (patch) | |
tree | b01637ca0d840e5644dbae3f90e54229abaeb9cd /net | |
parent | 062c98fe45c5c3b232742459f61ea250fbdf68fc (diff) | |
download | linux-stable-443b07a45cb71f6ca26d7d99ac19f9f9a46922df.tar.gz linux-stable-443b07a45cb71f6ca26d7d99ac19f9f9a46922df.tar.bz2 linux-stable-443b07a45cb71f6ca26d7d99ac19f9f9a46922df.zip |
p9_client_readdir() fix
commit 71d6ad08379304128e4bdfaf0b4185d54375423e upstream.
Don't assume that server is sane and won't return more data than
asked for.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'net')
-rw-r--r-- | net/9p/client.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/9p/client.c b/net/9p/client.c index 55a55ce92dc1..1a39a660dd18 100644 --- a/net/9p/client.c +++ b/net/9p/client.c @@ -2107,6 +2107,10 @@ int p9_client_readdir(struct p9_fid *fid, char *data, u32 count, u64 offset) trace_9p_protocol_dump(clnt, req->rc); goto free_and_error; } + if (rsize < count) { + pr_err("bogus RREADDIR count (%d > %d)\n", count, rsize); + count = rsize; + } p9_debug(P9_DEBUG_9P, "<<< RREADDIR count %d\n", count); |