diff options
author | Yan, Zheng <zyan@redhat.com> | 2018-08-03 04:24:49 -0400 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2018-08-13 11:55:44 -0400 |
commit | 0fcf6c02b205f80f24eb548b236543ec151cb01c (patch) | |
tree | b6995a6a5a7ca79d2d9d0f1c728f63cda66bbe6a | |
parent | 342ce1823ebaec573ac269b56bca78c698fec5c3 (diff) |
ceph: don't drop message if it contains more data than expected
Later version mds may encode more data into messages.
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
-rw-r--r-- | fs/ceph/mds_client.c | 6 | ||||
-rw-r--r-- | fs/ceph/quota.c | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 5b767cf1f780..bc43c822426a 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
@@ -3406,10 +3406,10 @@ static void handle_lease(struct ceph_mds_client *mdsc, | |||
3406 | vino.ino = le64_to_cpu(h->ino); | 3406 | vino.ino = le64_to_cpu(h->ino); |
3407 | vino.snap = CEPH_NOSNAP; | 3407 | vino.snap = CEPH_NOSNAP; |
3408 | seq = le32_to_cpu(h->seq); | 3408 | seq = le32_to_cpu(h->seq); |
3409 | dname.name = (void *)h + sizeof(*h) + sizeof(u32); | 3409 | dname.len = get_unaligned_le32(h + 1); |
3410 | dname.len = msg->front.iov_len - sizeof(*h) - sizeof(u32); | 3410 | if (msg->front.iov_len < sizeof(*h) + sizeof(u32) + dname.len) |
3411 | if (dname.len != get_unaligned_le32(h+1)) | ||
3412 | goto bad; | 3411 | goto bad; |
3412 | dname.name = (void *)(h + 1) + sizeof(u32); | ||
3413 | 3413 | ||
3414 | /* lookup inode */ | 3414 | /* lookup inode */ |
3415 | inode = ceph_find_inode(sb, vino); | 3415 | inode = ceph_find_inode(sb, vino); |
diff --git a/fs/ceph/quota.c b/fs/ceph/quota.c index 242bfa5c0539..32d4f13784ba 100644 --- a/fs/ceph/quota.c +++ b/fs/ceph/quota.c | |||
@@ -48,7 +48,7 @@ void ceph_handle_quota(struct ceph_mds_client *mdsc, | |||
48 | struct inode *inode; | 48 | struct inode *inode; |
49 | struct ceph_inode_info *ci; | 49 | struct ceph_inode_info *ci; |
50 | 50 | ||
51 | if (msg->front.iov_len != sizeof(*h)) { | 51 | if (msg->front.iov_len < sizeof(*h)) { |
52 | pr_err("%s corrupt message mds%d len %d\n", __func__, | 52 | pr_err("%s corrupt message mds%d len %d\n", __func__, |
53 | session->s_mds, (int)msg->front.iov_len); | 53 | session->s_mds, (int)msg->front.iov_len); |
54 | ceph_msg_dump(msg); | 54 | ceph_msg_dump(msg); |