mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: "Luís Henriques" <lhenriques@suse.de>,
	"Xiubo Li" <xiubli@redhat.com>,
	"Ilya Dryomov" <idryomov@gmail.com>
Cc: ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ceph: fix decoding of client session messages flags
Date: Mon, 23 May 2022 12:19:27 -0400	[thread overview]
Message-ID: <1e1f7397d516f8b9780b08763f6338cd4ce83506.camel@kernel.org> (raw)
In-Reply-To: <20220523160951.8781-1-lhenriques@suse.de>

On Mon, 2022-05-23 at 17:09 +0100, Luís Henriques wrote:
> 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.
> 
> Fixes: e1c9788cb397 ("ceph: don't rely on error_string to validate blocklisted session.")
> Signed-off-by: Luís Henriques <lhenriques@suse.de>
> ---
>  fs/ceph/mds_client.c | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
> index 00c3de177dd6..1bd3e1bb0fdf 100644
> --- a/fs/ceph/mds_client.c
> +++ b/fs/ceph/mds_client.c
> @@ -3375,13 +3375,17 @@ static void handle_session(struct ceph_mds_session *session,
>  	}
>  
>  	if (msg_version >= 5) {
> -		u32 flags;
> -		/* version >= 4, struct_v, struct_cv, len, metric_spec */
> -	        ceph_decode_skip_n(&p, end, 2 + sizeof(u32) * 2, bad);
> +		u32 flags, len;
> +
> +		/* version >= 4 */
> +		ceph_decode_skip_16(&p, end, bad); /* struct_v, struct_cv */
> +		ceph_decode_32_safe(&p, end, len, bad); /* len */
> +		ceph_decode_skip_n(&p, end, len, bad); /* metric_spec */
> +
>  		/* version >= 5, flags   */
> -                ceph_decode_32_safe(&p, end, flags, bad);
> +		ceph_decode_32_safe(&p, end, flags, bad);
>  		if (flags & CEPH_SESSION_BLOCKLISTED) {
> -		        pr_warn("mds%d session blocklisted\n", session->s_mds);
> +			pr_warn("mds%d session blocklisted\n", session->s_mds);
>  			blocklisted = true;
>  		}
>  	}

Good catch! Should we send this to stable too?

Reviewed-by: Jeff Layton <jlayton@kernel.org>

  reply	other threads:[~2022-05-23 16:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-23 16:09 Luís Henriques
2022-05-23 16:19 ` Jeff Layton [this message]
2022-05-23 16:34   ` Luís Henriques
2022-05-24  1:20     ` Xiubo Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1e1f7397d516f8b9780b08763f6338cd4ce83506.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.com \
    --cc=lhenriques@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xiubli@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®