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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9cae961a-881d-8678-6ec3-0fd00c74c8ad@windriver.com>
Date:   Fri, 5 Feb 2021 16:46:16 +0800
From:   Xulin Sun <xulin.sun@...driver.com>
To:     Marc Kleine-Budde <mkl@...gutronix.de>
Cc:     wg@...ndegger.com, dmurphy@...com, sriram.dash@...sung.com,
        kuba@...nel.org, davem@...emloft.net, linux-can@...r.kernel.org,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        xulinsun@...il.com
Subject: Re: [PATCH 2/2] can: m_can: m_can_class_allocate_dev(): remove
 impossible error return judgment

On 2021/2/5 下午4:19, Marc Kleine-Budde wrote:
> On 05.02.2021 15:25:59, Xulin Sun wrote:
>> If the previous can_net device has been successfully allocated, its
>> private data structure is impossible to be empty, remove this redundant
>> error return judgment. Otherwise, memory leaks for alloc_candev() will
>> be triggered.
> Your analysis is correct, the netdev_priv() will never fail. But how
> will this trigger a mem leak on alloc_candev()? I've removed that

Hi Marc,

The previous code judges the netdev_priv is empty, and then goto out. 
The correct approach should add free_candev(net_dev) before goto.

The code Like:

         class_dev = netdev_priv(net_dev);
         if (!class_dev) {
                 dev_err(dev, "Failed to init netdev cdevate");
+               free_candev(net_dev);
                 goto out;
         }

Otherwise, memory leaks for alloc_candev() will be triggered.

Now directly remove the impossible error return judgment to resolve the above possible issue.

Thanks

Xulin

> statement. I'll add it back, if I've missed something.
>
>> Signed-off-by: Xulin Sun <xulin.sun@...driver.com>
> Applied to linux-can-next/testing.
>
> Thanks,
> Marc
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ