diff mbox

Fix segfault when fast_io_fail_tmo is empty in config file.

Message ID 1398846013-2601-1-git-send-email-jcastillo@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: christophe varoqui
Headers show

Commit Message

Jose Castillo April 30, 2014, 8:20 a.m. UTC
If the option "fast_io_fail_tmo" is specified in multipath.conf, without a value, the command 'multipathd reconfigure' segfaults.
With the patch included here, multipathd returns "error parsing config file" and does not segfaults.

Signed-off-by: Jose Castillo <jcastillo@redhat.com>
---
 libmultipath/dict.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Christophe Varoqui April 30, 2014, 1:53 p.m. UTC | #1
Applied.
Thanks.


On Wed, Apr 30, 2014 at 10:20 AM, Jose Castillo <jcastillo@redhat.com>wrote:

> If the option "fast_io_fail_tmo" is specified in multipath.conf, without a
> value, the command 'multipathd reconfigure' segfaults.
> With the patch included here, multipathd returns "error parsing config
> file" and does not segfaults.
>
> Signed-off-by: Jose Castillo <jcastillo@redhat.com>
> ---
>  libmultipath/dict.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/libmultipath/dict.c b/libmultipath/dict.c
> index 9db4725..91d9b83 100644
> --- a/libmultipath/dict.c
> +++ b/libmultipath/dict.c
> @@ -43,6 +43,9 @@ def_fast_io_fail_handler(vector strvec)
>         char * buff;
>
>         buff = set_value(strvec);
> +       if (!buff)
> +               return 1;
> +
>         if (strlen(buff) == 3 && !strcmp(buff, "off"))
>                 conf->fast_io_fail = MP_FAST_IO_FAIL_OFF;
>         else if (sscanf(buff, "%d", &conf->fast_io_fail) != 1 ||
> --
> 1.9.0
>
> --
> dm-devel mailing list
> dm-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel
>
--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
diff mbox

Patch

diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index 9db4725..91d9b83 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -43,6 +43,9 @@  def_fast_io_fail_handler(vector strvec)
 	char * buff;
 
 	buff = set_value(strvec);
+	if (!buff)
+		return 1;
+
 	if (strlen(buff) == 3 && !strcmp(buff, "off"))
 		conf->fast_io_fail = MP_FAST_IO_FAIL_OFF;
 	else if (sscanf(buff, "%d", &conf->fast_io_fail) != 1 ||