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] [thread-next>] [day] [month] [year] [list]
Message-ID: <1557479671.7859.2.camel@pengutronix.de>
Date:   Fri, 10 May 2019 11:14:31 +0200
From:   Philipp Zabel <p.zabel@...gutronix.de>
To:     Colin King <colin.king@...onical.com>
Cc:     kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org,
        Bartosz Golaszewski <bgolaszewski@...libre.com>
Subject: Re: [PATCH] reset: fix potential null pointer dereference on
 pointer dev

Hi Colin,

[added Bartosz to Cc:]

On Thu, 2019-05-09 at 17:00 +0100, Colin King wrote:
> From: Colin Ian King <colin.king@...onical.com>
> 
> Pointer dev is being dereferenced when passed to the inlined
> functon dev_name, however, dev is later being null checked.
> Thus there is a potential null pointer dereference on a null
> dev. Fix this by performing the null check on dev before
> dereferencing it.
> 
> Addresses-Coverity: ("Dereference before null check")
> Fixes: 6691dffab0ab ("reset: add support for non-DT systems")
> Signed-off-by: Colin Ian King <colin.king@...onical.com>
> ---
>  drivers/reset/core.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/reset/core.c b/drivers/reset/core.c
> index 81ea77cba123..83f1a1d5ee67 100644
> --- a/drivers/reset/core.c
> +++ b/drivers/reset/core.c
> @@ -691,12 +691,13 @@ __reset_control_get_from_lookup(struct device *dev, const char *con_id,
>  {
>  	const struct reset_control_lookup *lookup;
>  	struct reset_controller_dev *rcdev;
> -	const char *dev_id = dev_name(dev);
> +	const char *dev_id;
>  	struct reset_control *rstc = NULL;
>  
>  	if (!dev)
>  		return ERR_PTR(-EINVAL);

Thank you for the patch. I think this check should be removed instead,
though, as __reset_control_get_from_lookup is only ever called from
__reset_control_get, right after checking dev->of_node. So dev can not
be NULL here.

regards
Philipp

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ