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: <60c9a7c8-95f1-2673-abd0-73853483acb0@canonical.com>
Date:   Tue, 15 Jun 2021 09:33:36 +0100
From:   Colin Ian King <colin.king@...onical.com>
To:     Dan Carpenter <dan.carpenter@...cle.com>
Cc:     Florian Fainelli <f.fainelli@...il.com>,
        Andrew Lunn <andrew@...n.ch>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Vladimir Oltean <olteanv@...il.com>,
        "David S . Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
        kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: dsa: b53: Fix dereference of null dev

On 14/06/2021 12:28, Dan Carpenter wrote:
> On Sat, Jun 12, 2021 at 03:44:07PM +0100, Colin King wrote:
>> From: Colin Ian King <colin.king@...onical.com>
>>
>> Currently pointer priv is dereferencing dev before dev is being null
>> checked so a potential null pointer dereference can occur. Fix this
>> by only assigning and using priv if dev is not-null.
>>
>> Addresses-Coverity: ("Dereference before null check")
>> Fixes: 16994374a6fc ("net: dsa: b53: Make SRAB driver manage port interrupts")
>> Signed-off-by: Colin Ian King <colin.king@...onical.com>
>> ---
>>  drivers/net/dsa/b53/b53_srab.c | 8 +++++---
>>  1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/net/dsa/b53/b53_srab.c b/drivers/net/dsa/b53/b53_srab.c
>> index aaa12d73784e..e77ac598f859 100644
>> --- a/drivers/net/dsa/b53/b53_srab.c
>> +++ b/drivers/net/dsa/b53/b53_srab.c
>> @@ -629,11 +629,13 @@ static int b53_srab_probe(struct platform_device *pdev)
>>  static int b53_srab_remove(struct platform_device *pdev)
>>  {
>>  	struct b53_device *dev = platform_get_drvdata(pdev);
>> -	struct b53_srab_priv *priv = dev->priv;
>>  
>> -	b53_srab_intr_set(priv, false);
>> -	if (dev)
>> +	if (dev) {
> 
> This is the remove function and "dev" can't be NULL at this point.
> Better to just remove the NULL check.

Will do.

> 
> regards,
> dan carpenter
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ