All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Marzinski <bmarzins@redhat.com>
To: mwilck@suse.com
Cc: lixiaokeng@huawei.com, dm-devel@redhat.com
Subject: Re: [dm-devel] [PATCH] libmultipath: check if adopt_path() really added current path
Date: Tue, 2 Feb 2021 14:40:21 -0600	[thread overview]
Message-ID: <20210202204021.GV15006@octiron.msp.redhat.com> (raw)
In-Reply-To: <20210202195744.2384-1-mwilck@suse.com>

On Tue, Feb 02, 2021 at 08:57:44PM +0100, mwilck@suse.com wrote:
> From: Martin Wilck <mwilck@suse.com>
> 
> The description of 2d32d6f ("libmultipath: adopt_paths(): don't bail out on
> single path failure") said "we need to check after successful call to
> adopt_paths() if that specific path had been actually added, and fail in the
> caller otherwise". But the commit failed to actually implement this check.
> Instead, it just checked if the path was member of the pathvec, which will
> almost always be the case.
> 
> Fix it by checking what actually needs to be checked, membership of the
> path to be added in mpp->paths.
> 
> Fixes: 2d32d6f ("libmultipath: adopt_paths(): don't bail out on single path failure")
> Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
> ---
> 
> @lixiaokeng, I believe that this fixes the issue you mentioned in your
> post "libmultipath: fix NULL dereference in get_be64".
> 
> ---
>  libmultipath/structs_vec.c | 4 ++--
>  multipathd/main.c          | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
> index f7f45f1..47b1d03 100644
> --- a/libmultipath/structs_vec.c
> +++ b/libmultipath/structs_vec.c
> @@ -707,8 +707,8 @@ struct multipath *add_map_with_path(struct vectors *vecs, struct path *pp,
>  		goto out;
>  	mpp->size = pp->size;
>  
> -	if (adopt_paths(vecs->pathvec, mpp) ||
> -	    find_slot(vecs->pathvec, pp) == -1)
> +	if (adopt_paths(vecs->pathvec, mpp) || pp->mpp != mpp ||
> +	    find_slot(mpp->paths, pp) == -1)
>  		goto out;
>  
>  	if (add_vec) {
> diff --git a/multipathd/main.c b/multipathd/main.c
> index 134185f..425492a 100644
> --- a/multipathd/main.c
> +++ b/multipathd/main.c
> @@ -1008,8 +1008,8 @@ rescan:
>  	if (mpp) {
>  		condlog(4,"%s: adopting all paths for path %s",
>  			mpp->alias, pp->dev);
> -		if (adopt_paths(vecs->pathvec, mpp) ||
> -		    find_slot(vecs->pathvec, pp) == -1)
> +		if (adopt_paths(vecs->pathvec, mpp) || pp->mpp != mpp ||
> +		    find_slot(mpp->paths, pp) == -1)
>  			goto fail; /* leave path added to pathvec */
>  
>  		verify_paths(mpp);
> -- 
> 2.29.2

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


  reply	other threads:[~2021-02-02 20:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-02 19:57 [dm-devel] [PATCH] libmultipath: check if adopt_path() really added current path mwilck
2021-02-02 20:40 ` Benjamin Marzinski [this message]
2021-02-03  1:33 ` lixiaokeng
2021-02-03  8:14   ` Martin Wilck
2021-02-03  9:42     ` lixiaokeng
2021-02-03 13:14       ` Martin Wilck
2021-02-04  7:41         ` lixiaokeng
2021-02-04 11:14           ` Martin Wilck

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=20210202204021.GV15006@octiron.msp.redhat.com \
    --to=bmarzins@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=lixiaokeng@huawei.com \
    --cc=mwilck@suse.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.