diff options
author | Jeff Layton <jlayton@kernel.org> | 2020-04-28 08:10:22 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-05-14 07:58:27 +0200 |
commit | 3fd9f902c08a9506f24c0857c2cb321d3d72c8dc (patch) | |
tree | 32cbf7b800d49699576cab86a02f67f3e9e5ee8d | |
parent | e991f7ded4e11dab9c29c8ddec838f97c1067f35 (diff) | |
download | linux-stable-3fd9f902c08a9506f24c0857c2cb321d3d72c8dc.tar.gz linux-stable-3fd9f902c08a9506f24c0857c2cb321d3d72c8dc.tar.bz2 linux-stable-3fd9f902c08a9506f24c0857c2cb321d3d72c8dc.zip |
ceph: fix endianness bug when handling MDS session feature bits
commit 0fa8263367db9287aa0632f96c1a5f93cc478150 upstream.
Eduard reported a problem mounting cephfs on s390 arch. The feature
mask sent by the MDS is little-endian, so we need to convert it
before storing and testing against it.
Cc: stable@vger.kernel.org
Reported-and-Tested-by: Eduard Shishkin <edward6@linux.ibm.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | fs/ceph/mds_client.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 8c1f04c3a684..b79fe6549df6 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -3072,8 +3072,7 @@ static void handle_session(struct ceph_mds_session *session, void *end = p + msg->front.iov_len; struct ceph_mds_session_head *h; u32 op; - u64 seq; - unsigned long features = 0; + u64 seq, features = 0; int wake = 0; bool blacklisted = false; @@ -3092,9 +3091,8 @@ static void handle_session(struct ceph_mds_session *session, goto bad; /* version >= 3, feature bits */ ceph_decode_32_safe(&p, end, len, bad); - ceph_decode_need(&p, end, len, bad); - memcpy(&features, p, min_t(size_t, len, sizeof(features))); - p += len; + ceph_decode_64_safe(&p, end, features, bad); + p += len - sizeof(features); } mutex_lock(&mdsc->mutex); |