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: <YHA7UtJ4o1BNHc1K@orome.fritz.box>
Date:   Fri, 9 Apr 2021 13:32:34 +0200
From:   Thierry Reding <thierry.reding@...il.com>
To:     Yang Yingliang <yangyingliang@...wei.com>
Cc:     linux-kernel@...r.kernel.org, linux-tegra@...r.kernel.org,
        jonathanh@...dia.com
Subject: Re: [PATCH -next] soc/tegra: fuse: add missing iounmap() on error in
 tegra_init_fuse()

On Fri, Apr 09, 2021 at 12:49:03PM +0800, Yang Yingliang wrote:
> Add the missing iounmap() before return from tegra_init_fuse()
> in the error handling case.
> 
> Fixes: 9f94fadd75d3 ("soc/tegra: fuse: Register cell lookups for compatibility")
> Reported-by: Hulk Robot <hulkci@...wei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
> ---
>  drivers/soc/tegra/fuse/fuse-tegra.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
> index 94b60a692b51..bc8d70e6a676 100644
> --- a/drivers/soc/tegra/fuse/fuse-tegra.c
> +++ b/drivers/soc/tegra/fuse/fuse-tegra.c
> @@ -489,8 +489,10 @@ static int __init tegra_init_fuse(void)
>  		size_t size = sizeof(*fuse->lookups) * fuse->soc->num_lookups;
>  
>  		fuse->lookups = kmemdup(fuse->soc->lookups, size, GFP_KERNEL);
> -		if (!fuse->lookups)
> +		if (!fuse->lookups) {
> +			iounmap(fuse->base);
>  			return -ENOMEM;
> +		}
>  
>  		nvmem_add_cell_lookups(fuse->lookups, fuse->soc->num_lookups);
>  	}

I don't think that's a good idea. Given that this is an early_initcall,
the failure doesn't actually prevent the driver from loading. There are
other functions that rely on fuse->base staying around to access some of
the registers in that I/O memory region.

I suppose we could remove the -ENOMEM return there and instead just skip
registering the nvmem cell lookups, perhaps that would make this less
confusing.

Thierry

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ