Skip to content

Commit 91ce8d1

Browse files
Al Virogregkh
authored andcommitted
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3bf0809 commit 91ce8d1

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

net/9p/client.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2101,6 +2101,10 @@ int p9_client_readdir(struct p9_fid *fid, char *data, u32 count, u64 offset)
21012101
trace_9p_protocol_dump(clnt, req->rc);
21022102
goto free_and_error;
21032103
}
2104+
if (rsize < count) {
2105+
pr_err("bogus RREADDIR count (%d > %d)\n", count, rsize);
2106+
count = rsize;
2107+
}
21042108

21052109
p9_debug(P9_DEBUG_9P, "<<< RREADDIR count %d\n", count);
21062110

0 commit comments

Comments
 (0)