diff mbox series

[1/7] libmultipath: set pp->checkint in store_pathinfo()

Message ID 20181023220552.1306-2-mwilck@suse.com (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show
Series multipathd: make uxlsnr errors really fatal | expand

Commit Message

Martin Wilck Oct. 23, 2018, 10:05 p.m. UTC
store_pathinfo is called with valid conf pointer anyway, so
checkint is available. pp->checkint is now valid for every
path after path_discovery().

This fixes a bad conf access in cli_add_path().

Cc: Bart Van Assche <Bart.VanAssche@sandisk.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 libmultipath/discovery.c  | 1 +
 multipathd/cli_handlers.c | 1 -
 multipathd/main.c         | 2 --
 3 files changed, 1 insertion(+), 3 deletions(-)

Comments

Benjamin Marzinski Oct. 26, 2018, 6:53 p.m. UTC | #1
On Wed, Oct 24, 2018 at 12:05:46AM +0200, Martin Wilck wrote:
> store_pathinfo is called with valid conf pointer anyway, so
> checkint is available. pp->checkint is now valid for every
> path after path_discovery().
> 
> This fixes a bad conf access in cli_add_path().
> 

Reviewed-by: Benjamin Marzinsk <bmarzins@redhat.com>

> Cc: Bart Van Assche <Bart.VanAssche@sandisk.com>
> Signed-off-by: Martin Wilck <mwilck@suse.com>
> ---
>  libmultipath/discovery.c  | 1 +
>  multipathd/cli_handlers.c | 1 -
>  multipathd/main.c         | 2 --
>  3 files changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
> index 467ece7a..4ac3fde1 100644
> --- a/libmultipath/discovery.c
> +++ b/libmultipath/discovery.c
> @@ -103,6 +103,7 @@ store_pathinfo (vector pathvec, struct config *conf,
>  	err = store_path(pathvec, pp);
>  	if (err)
>  		goto out;
> +	pp->checkint = conf->checkint;
>  
>  out:
>  	if (err)
> diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
> index 75000807..4aea4ce7 100644
> --- a/multipathd/cli_handlers.c
> +++ b/multipathd/cli_handlers.c
> @@ -736,7 +736,6 @@ cli_add_path (void * v, char ** reply, int * len, void * data)
>  			condlog(0, "%s: failed to store path info", param);
>  			return 1;
>  		}
> -		pp->checkint = conf->checkint;
>  	}
>  	return ev_add_path(pp, vecs, 1);
>  blacklisted:
> diff --git a/multipathd/main.c b/multipathd/main.c
> index e80ac906..b8423d89 100644
> --- a/multipathd/main.c
> +++ b/multipathd/main.c
> @@ -2322,8 +2322,6 @@ configure (struct vectors * vecs)
>  			free_path(pp);
>  			i--;
>  		}
> -		else
> -			pp->checkint = conf->checkint;
>  		pthread_cleanup_pop(1);
>  	}
>  	if (map_discovery(vecs)) {
> -- 
> 2.19.1

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

Patch

diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 467ece7a..4ac3fde1 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -103,6 +103,7 @@  store_pathinfo (vector pathvec, struct config *conf,
 	err = store_path(pathvec, pp);
 	if (err)
 		goto out;
+	pp->checkint = conf->checkint;
 
 out:
 	if (err)
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index 75000807..4aea4ce7 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -736,7 +736,6 @@  cli_add_path (void * v, char ** reply, int * len, void * data)
 			condlog(0, "%s: failed to store path info", param);
 			return 1;
 		}
-		pp->checkint = conf->checkint;
 	}
 	return ev_add_path(pp, vecs, 1);
 blacklisted:
diff --git a/multipathd/main.c b/multipathd/main.c
index e80ac906..b8423d89 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -2322,8 +2322,6 @@  configure (struct vectors * vecs)
 			free_path(pp);
 			i--;
 		}
-		else
-			pp->checkint = conf->checkint;
 		pthread_cleanup_pop(1);
 	}
 	if (map_discovery(vecs)) {