[dm-devel] libmultipath: fix NULL dereference in get_be64

Martin Wilck mwilck at suse.com
Mon Feb 1 11:16:38 UTC 2021


Hello lixiaokeng,

On Sun, 2021-01-31 at 18:55 +0800, lixiaokeng wrote:
> When find_multipaths is no and add local path by multiapthd,
> the local path will be filtered by filter_property. The
> pp->mpp is not set in adopt_paths. Then the pp->mpp will be
> dereferenced in get_be6.
> 
> Here add check pp->mpp in ev_add_path.
> 
> Signed-off-by: Lixiaokeng <lixiaokeng at huawei.com>

I don't understand. All callers (uev_add_path(), cli_add_path(),
check_path()) call pathinfo() first, which would return
PATHINFO_SKIPPED if the path was blacklisted. How do you end up 
in ev_add_path() with a blacklisted path?

And how is it possible that add_map_with_path(vecs, pp, 1) returns non-
NULL and pp->mpp is NULL?

Please explain.

Martin



> ---
>  multipathd/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/multipathd/main.c b/multipathd/main.c
> index a4abbb2..8ad8bea 100644
> --- a/multipathd/main.c
> +++ b/multipathd/main.c
> @@ -1010,7 +1010,7 @@ rescan:
>             return 0;
>         }
>         condlog(4,"%s: creating new map", pp->dev);
> -       if ((mpp = add_map_with_path(vecs, pp, 1))) {
> +       if ((mpp = add_map_with_path(vecs, pp, 1)) && pp->mpp) {
>             mpp->action = ACT_CREATE;
>             /*
>              * We don't depend on ACT_CREATE, as domap will








More information about the dm-devel mailing list