Re: [PATCH v3 10/19] libmultipath: fix memory issue in path_latency prio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2018-09-21 at 18:05 -0500, Benjamin Marzinski wrote:
> The path_latency prioriziter was assuming that
> prepare_directio_read()
> always succeeds. However, it doesn't, and when it fails, the
> prioritizer
> used buf without it pointing to alloced memory. Found by coverity.
> 
> Signed-off-by: Benjamin Marzinski <bmarzins@xxxxxxxxxx>

Reviewed-by: Martin Wilck <mwilck@xxxxxxxx>

> ---
>  libmultipath/prioritizers/path_latency.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libmultipath/prioritizers/path_latency.c
> b/libmultipath/prioritizers/path_latency.c
> index 765265c..eeee01e 100644
> --- a/libmultipath/prioritizers/path_latency.c
> +++ b/libmultipath/prioritizers/path_latency.c
> @@ -237,7 +237,8 @@ int getprio(struct path *pp, char *args, unsigned
> int timeout)
>  	lg_maxavglatency = log(MAX_AVG_LATENCY) / lg_base;
>  	lg_minavglatency = log(MIN_AVG_LATENCY) / lg_base;
>  
> -	prepare_directio_read(pp->fd, &blksize, &buf, &restore_flags);
> +	if (prepare_directio_read(pp->fd, &blksize, &buf,
> &restore_flags) < 0)
> +		return PRIO_UNDEF;
>  
>  	temp = io_num;
>  	while (temp-- > 0) {

-- 
Dr. Martin Wilck <mwilck@xxxxxxxx>, Tel. +49 (0)911 74053 2107
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)


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




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux