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]
Date:	Mon, 6 Oct 2014 22:14:43 +0100
From:	Lee Jones <lee.jones@...aro.org>
To:	Xiubo Li <Li.Xiubo@...escale.com>
Cc:	sameo@...ux.intel.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mfd: core: Fix possible ZERO_SIZE_PTR pointer
 dereferencing error.

On Thu, 18 Sep 2014, Xiubo Li wrote:

> Since we cannot make sure the 'cell->num_resources' will always be none
> zero here, and then if either equal to zero, the kzalloc() will return
> ZERO_SIZE_PTR, which equals to ((void *)16).
> 
> So this patch fix this with just doing the zero check before calling
> kzalloc().
> 
> Signed-off-by: Xiubo Li <Li.Xiubo@...escale.com>
> ---
>  drivers/mfd/mfd-core.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
> index 892d343..54c7e35 100644
> --- a/drivers/mfd/mfd-core.c
> +++ b/drivers/mfd/mfd-core.c
> @@ -89,6 +89,9 @@ static int mfd_add_device(struct device *parent, int id,
>  	int ret = -ENOMEM;
>  	int r;
>  
> +	if (!cell->num_resources)
> +		return -EINVAL;

Resources are not compulsory.

>  	pdev = platform_device_alloc(cell->name, id + cell->id);
>  	if (!pdev)
>  		goto fail_alloc;

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ