All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xiubo Li <xiubli@redhat.com>
To: Jeff Layton <jlayton@kernel.org>, ceph-devel@vger.kernel.org
Cc: pdonnell@redhat.com, idryomov@gmail.com
Subject: Re: [PATCH] ceph: ensure we return an error when parsing corrupt mdsmap
Date: Mon, 30 Aug 2021 21:01:29 +0800	[thread overview]
Message-ID: <3de857b0-8b74-46ff-5159-887d5a732f1c@redhat.com> (raw)
In-Reply-To: <20210830121045.13994-1-jlayton@kernel.org>


On 8/30/21 8:10 PM, Jeff Layton wrote:
> Commit ba5e57de7b20 (ceph: reconnect to the export targets on new
> mdsmaps) changed ceph_mdsmap_decode to "goto corrupt" when given a
> bogus mds rank in the export targets. It did not set the err variable
> however, which caused that function to return a NULL pointer instead of
> a proper ERR_PTR value for the error.
>
> Fix this by setting err before doing the "goto corrupt".
>
> URL: https://tracker.ceph.com/issues/52436
> Fixes: ba5e57de7b20 ("ceph: reconnect to the export targets on new mdsmaps")
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
>   fs/ceph/mdsmap.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> I'll plan to fold this change into the original patch since it hasn't
> been merged yet. Let me know if you have objections.
>
> diff --git a/fs/ceph/mdsmap.c b/fs/ceph/mdsmap.c
> index d995cb02d30c..61d67cbcb367 100644
> --- a/fs/ceph/mdsmap.c
> +++ b/fs/ceph/mdsmap.c
> @@ -263,8 +263,10 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end, bool msgr2)
>   				goto nomem;
>   			for (j = 0; j < num_export_targets; j++) {
>   				target = ceph_decode_32(&pexport_targets);
> -				if (target >= m->possible_max_rank)
> +				if (target >= m->possible_max_rank) {
> +					err = -EIO;
>   					goto corrupt;
> +				}
>   				info->export_targets[j] = target;
>   			}
>   		} else {

Make sense and LGTM.



      reply	other threads:[~2021-08-30 13:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-30 12:10 [PATCH] ceph: ensure we return an error when parsing corrupt mdsmap Jeff Layton
2021-08-30 13:01 ` Xiubo Li [this message]

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=3de857b0-8b74-46ff-5159-887d5a732f1c@redhat.com \
    --to=xiubli@redhat.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.com \
    --cc=jlayton@kernel.org \
    --cc=pdonnell@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.