p9_client_readdir() fix
authorAl Viro <viro@zeniv.linux.org.uk>
Fri, 14 Apr 2017 21:22:18 +0000 (17:22 -0400)
committerWilly Tarreau <w@1wt.eu>
Tue, 20 Jun 2017 12:04:52 +0000 (14:04 +0200)
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: Willy Tarreau <w@1wt.eu>
net/9p/client.c

index 853d62327a58a3c082a863e41109b5a5fee17775..e191aab9e586582b04a7fbbfe61a95a086dc3bcb 100644 (file)
@@ -2080,6 +2080,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);