diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2017-04-14 23:22:18 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2017-04-17 20:23:20 +0200 |
commit | 71d6ad08379304128e4bdfaf0b4185d54375423e (patch) | |
tree | df6bc8ac4a4a30e38bfdf797a59482c03f4b9c1a /net/9p | |
parent | orangefs_bufmap_copy_from_iovec(): fix EFAULT handling (diff) | |
download | linux-71d6ad08379304128e4bdfaf0b4185d54375423e.tar.xz linux-71d6ad08379304128e4bdfaf0b4185d54375423e.zip |
p9_client_readdir() fix
Don't assume that server is sane and won't return more data than
asked for.
Cc: stable@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'net/9p')
-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 3ce672af1596..8e5c6a8d0a37 100644 --- a/net/9p/client.c +++ b/net/9p/client.c @@ -2101,6 +2101,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); |