lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1773a907-698f-d441-2fac-5a8f134aa3dd@axentia.se>
Date:   Sat, 26 Aug 2017 10:16:57 +0200
From:   Peter Rosin <peda@...ntia.se>
To:     Christophe JAILLET <christophe.jaillet@...adoo.fr>,
        jic23@...nel.org, knaack.h@....de, lars@...afoo.de,
        pmeerw@...erw.net
Cc:     linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
        kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] iio: multiplexer: check memory allocation failure

On 2017-08-26 07:49, Christophe JAILLET wrote:
> Check memory allocation failures and return -ENOMEM in such cases, as
> already done few lines above for another memory allocation.
> 
> This avoids NULL pointers dereference.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>

Hi!

This is a dup of an older patch [1].

Cheers,
peda

[1] https://patchwork.kernel.org/patch/9829567/

> ---
>  drivers/iio/multiplexer/iio-mux.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/iio/multiplexer/iio-mux.c b/drivers/iio/multiplexer/iio-mux.c
> index 37ba007f8dca..74831fcd0313 100644
> --- a/drivers/iio/multiplexer/iio-mux.c
> +++ b/drivers/iio/multiplexer/iio-mux.c
> @@ -285,6 +285,9 @@ static int mux_configure_channel(struct device *dev, struct mux *mux,
>  	child->ext_info_cache = devm_kzalloc(dev,
>  					     sizeof(*child->ext_info_cache) *
>  					     num_ext_info, GFP_KERNEL);
> +	if (!child->ext_info_cache)
> +		return -ENOMEM;
> +
>  	for (i = 0; i < num_ext_info; ++i) {
>  		child->ext_info_cache[i].size = -1;
>  
> @@ -309,6 +312,9 @@ static int mux_configure_channel(struct device *dev, struct mux *mux,
>  
>  		child->ext_info_cache[i].data = devm_kmemdup(dev, page, ret + 1,
>  							     GFP_KERNEL);
> +		if (!child->ext_info_cache[i].data)
> +			return -ENOMEM;
> +
>  		child->ext_info_cache[i].data[ret] = 0;
>  		child->ext_info_cache[i].size = ret;
>  	}
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ