diff options
| author | Al Viro <viro@zeniv.linux.org.uk> | 2015-07-04 16:17:39 -0400 |
|---|---|---|
| committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-07-04 16:17:39 -0400 |
| commit | 0f1db7dee200127da4c07928189748918c312031 (patch) | |
| tree | bd2abe8f6e2929335e9326afa56f06102386c224 | |
| parent | 67e808fbb0404a12d9b9830a44bbb48d447d8bc9 (diff) | |
9p: cope with bogus responses from server in p9_client_{read,write}
if server claims to have written/read more than we'd told it to,
warn and cap the claimed byte count to avoid advancing more than
we are ready to.
| -rw-r--r-- | net/9p/client.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/net/9p/client.c b/net/9p/client.c index 81925b923318..498454b3c06c 100644 --- a/net/9p/client.c +++ b/net/9p/client.c | |||
| @@ -1583,6 +1583,10 @@ p9_client_read(struct p9_fid *fid, u64 offset, struct iov_iter *to, int *err) | |||
| 1583 | p9_free_req(clnt, req); | 1583 | p9_free_req(clnt, req); |
| 1584 | break; | 1584 | break; |
| 1585 | } | 1585 | } |
| 1586 | if (rsize < count) { | ||
| 1587 | pr_err("bogus RREAD count (%d > %d)\n", count, rsize); | ||
| 1588 | count = rsize; | ||
| 1589 | } | ||
| 1586 | 1590 | ||
| 1587 | p9_debug(P9_DEBUG_9P, "<<< RREAD count %d\n", count); | 1591 | p9_debug(P9_DEBUG_9P, "<<< RREAD count %d\n", count); |
| 1588 | if (!count) { | 1592 | if (!count) { |
| @@ -1650,6 +1654,10 @@ p9_client_write(struct p9_fid *fid, u64 offset, struct iov_iter *from, int *err) | |||
| 1650 | p9_free_req(clnt, req); | 1654 | p9_free_req(clnt, req); |
| 1651 | break; | 1655 | break; |
| 1652 | } | 1656 | } |
| 1657 | if (rsize < count) { | ||
| 1658 | pr_err("bogus RWRITE count (%d > %d)\n", count, rsize); | ||
| 1659 | count = rsize; | ||
| 1660 | } | ||
| 1653 | 1661 | ||
| 1654 | p9_debug(P9_DEBUG_9P, "<<< RWRITE count %d\n", count); | 1662 | p9_debug(P9_DEBUG_9P, "<<< RWRITE count %d\n", count); |
| 1655 | 1663 | ||
