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: <1772626e-c521-a072-76e4-64e3b4883f2e@baylibre.com>
Date:   Tue, 20 Mar 2018 17:16:41 +0100
From:   Neil Armstrong <narmstrong@...libre.com>
To:     Wei Yongjun <weiyongjun1@...wei.com>,
        David Airlie <airlied@...ux.ie>,
        Carlo Caione <carlo@...one.org>,
        Kevin Hilman <khilman@...libre.com>
Cc:     kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org,
        dri-devel@...ts.freedesktop.org, linux-amlogic@...ts.infradead.org,
        linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH -next] drm/meson: Fix potential NULL dereference in
 meson_drv_bind_master()

On 20/03/2018 16:04, Neil Armstrong wrote:
> On 20/03/2018 15:20, Wei Yongjun wrote:
>> platform_get_resource_byname() may fail and return NULL, so we should
>> better check it's return value to avoid a NULL pointer dereference
>> a bit later in the code.
>>
>> This is detected by Coccinelle semantic patch.
>>
>> @@
>> expression pdev, res, n, t, e, e1, e2;
>> @@
>>
>> res = platform_get_resource_byname(pdev, t, n);
>> + if (!res)
>> +   return -EINVAL;
>> ... when != res == NULL
>> e = devm_ioremap(e1, res->start, e2);
>>
>> Signed-off-by: Wei Yongjun <weiyongjun1@...wei.com>
>> ---
>>  drivers/gpu/drm/meson/meson_drv.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
>> index 3baceb7..32b1a6c 100644
>> --- a/drivers/gpu/drm/meson/meson_drv.c
>> +++ b/drivers/gpu/drm/meson/meson_drv.c
>> @@ -197,6 +197,8 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
>>  	priv->io_base = regs;
>>  
>>  	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hhi");
>> +	if (!res)
>> +		return -EINVAL;
>>  	/* Simply ioremap since it may be a shared register zone */
>>  	regs = devm_ioremap(dev, res->start, resource_size(res));
>>  	if (!regs) {
>> @@ -213,6 +215,8 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
>>  	}
>>  
>>  	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dmc");
>> +	if (!res)
>> +		return -EINVAL;
>>  	/* Simply ioremap since it may be a shared register zone */
>>  	regs = devm_ioremap(dev, res->start, resource_size(res));
>>  	if (!regs) {
>>
>>
>> _______________________________________________
>> linux-amlogic mailing list
>> linux-amlogic@...ts.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-amlogic
>>
> Thanks,
> 
> Acked-by: Neil Armstrong <narmstrong@...libre.com>
> 

Applied to drm-misc-next

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ