Skip to content

Commit ea16567

Browse files
Luís Henriquesidryomov
authored andcommitted
ceph: fix decoding of client session messages flags
The cephfs kernel client started to show the message: ceph: mds0 session blocklisted when mounting a filesystem. This is due to the fact that the session messages are being incorrectly decoded: the skip needs to take into account the 'len'. While there, fixed some whitespaces too. Cc: stable@vger.kernel.org Fixes: e1c9788 ("ceph: don't rely on error_string to validate blocklisted session.") Signed-off-by: Luís Henriques <lhenriques@suse.de> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
1 parent 5e56776 commit ea16567

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

fs/ceph/mds_client.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3425,13 +3425,17 @@ static void handle_session(struct ceph_mds_session *session,
34253425
}
34263426

34273427
if (msg_version >= 5) {
3428-
u32 flags;
3429-
/* version >= 4, struct_v, struct_cv, len, metric_spec */
3430-
ceph_decode_skip_n(&p, end, 2 + sizeof(u32) * 2, bad);
3428+
u32 flags, len;
3429+
3430+
/* version >= 4 */
3431+
ceph_decode_skip_16(&p, end, bad); /* struct_v, struct_cv */
3432+
ceph_decode_32_safe(&p, end, len, bad); /* len */
3433+
ceph_decode_skip_n(&p, end, len, bad); /* metric_spec */
3434+
34313435
/* version >= 5, flags */
3432-
ceph_decode_32_safe(&p, end, flags, bad);
3436+
ceph_decode_32_safe(&p, end, flags, bad);
34333437
if (flags & CEPH_SESSION_BLOCKLISTED) {
3434-
pr_warn("mds%d session blocklisted\n", session->s_mds);
3438+
pr_warn("mds%d session blocklisted\n", session->s_mds);
34353439
blocklisted = true;
34363440
}
34373441
}

0 commit comments

Comments
 (0)