Skip to content

Commit 71d6ad0

Browse files
author
Al Viro
committed
p9_client_readdir() fix
Don't assume that server is sane and won't return more data than asked for. Cc: [email protected] Signed-off-by: Al Viro <[email protected]>
1 parent 890559e commit 71d6ad0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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)