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]
Date:   Wed, 24 Jan 2018 17:14:50 +0100
From:   Lars-Peter Clausen <lars@...afoo.de>
To:     David Lechner <david@...hnology.com>, linux-kernel@...r.kernel.org
Cc:     Mark Brown <broonie@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH 1/2] regmap: fix NULL pointer dereference in
 regmap_name_read_file()

On 01/23/2018 11:53 PM, David Lechner wrote:
> This fixes a possible NULL pointer dereference oops in
> regmap_name_read_file() when the regmap does not have a device
> associated with it.
> 
> Signed-off-by: David Lechner <david@...hnology.com>
> ---
>  drivers/base/regmap/regmap-debugfs.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
> index 36ce351..0df7379 100644
> --- a/drivers/base/regmap/regmap-debugfs.c
> +++ b/drivers/base/regmap/regmap-debugfs.c
> @@ -40,6 +40,7 @@ static ssize_t regmap_name_read_file(struct file *file,
>  				     loff_t *ppos)
>  {
>  	struct regmap *map = file->private_data;
> +	const char *name = NULL;
>  	int ret;
>  	char *buf;
>  
> @@ -47,7 +48,10 @@ static ssize_t regmap_name_read_file(struct file *file,
>  	if (!buf)
>  		return -ENOMEM;
>  
> -	ret = snprintf(buf, PAGE_SIZE, "%s\n", map->dev->driver->name);
> +	if (map->dev && map->dev->driver)
> +		name = map->dev->driver->name;
> +
> +	ret = snprintf(buf, PAGE_SIZE, "%s\n", name);

Won't this print "(null)" now? Not sure if that is the best approach.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ