Skip to content

Commit

Permalink
p9_client_readdir() fix
Browse files Browse the repository at this point in the history
commit 71d6ad0 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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Al Viro authored and gregkh committed May 8, 2017
1 parent 91f5719 commit 1c755e1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions net/9p/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -2106,6 +2106,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);

Expand Down

0 comments on commit 1c755e1

Please sign in to comment.