Commit 0fa82633 authored by Jeff Layton's avatar Jeff Layton Committed by Ilya Dryomov

ceph: fix endianness bug when handling MDS session feature bits

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: default avatarEduard Shishkin <edward6@linux.ibm.com>
Signed-off-by: default avatarJeff Layton <jlayton@kernel.org>
Reviewed-by: default avatar"Yan, Zheng" <zyan@redhat.com>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent 0e698dfa
...@@ -3251,8 +3251,7 @@ static void handle_session(struct ceph_mds_session *session, ...@@ -3251,8 +3251,7 @@ static void handle_session(struct ceph_mds_session *session,
void *end = p + msg->front.iov_len; void *end = p + msg->front.iov_len;
struct ceph_mds_session_head *h; struct ceph_mds_session_head *h;
u32 op; u32 op;
u64 seq; u64 seq, features = 0;
unsigned long features = 0;
int wake = 0; int wake = 0;
bool blacklisted = false; bool blacklisted = false;
...@@ -3271,9 +3270,8 @@ static void handle_session(struct ceph_mds_session *session, ...@@ -3271,9 +3270,8 @@ static void handle_session(struct ceph_mds_session *session,
goto bad; goto bad;
/* version >= 3, feature bits */ /* version >= 3, feature bits */
ceph_decode_32_safe(&p, end, len, bad); ceph_decode_32_safe(&p, end, len, bad);
ceph_decode_need(&p, end, len, bad); ceph_decode_64_safe(&p, end, features, bad);
memcpy(&features, p, min_t(size_t, len, sizeof(features))); p += len - sizeof(features);
p += len;
} }
mutex_lock(&mdsc->mutex); mutex_lock(&mdsc->mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment