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]
Message-ID: <8d4b0822-4e94-d124-e191-bec3effaf97c@gmail.com>
Date:   Fri, 21 Jan 2022 22:36:45 +0300
From:   Pavel Skripkin <paskripkin@...il.com>
To:     Dongliang Mu <mudongliangabcd@...il.com>
Cc:     Dongliang Mu <dzm91@...t.edu.cn>,
        Wolfgang Grandegger <wg@...ndegger.com>,
        Marc Kleine-Budde <mkl@...gutronix.de>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Stephane Grosjean <s.grosjean@...k-system.com>,
        Stefan Mätje <stefan.maetje@....eu>,
        Vincent Mailhol <mailhol.vincent@...adoo.fr>,
        linux-can@...r.kernel.org,
        "open list:NETWORKING [GENERAL]" <netdev@...r.kernel.org>,
        linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] drivers: net: remove a dangling pointer in
 peak_usb_create_dev

Hi Dongliang,

On 1/21/22 08:58, Dongliang Mu wrote:
[...]>> BTW, as you mentioned, dev->next_siblings is used in struct
>> peak_usb_adapter::dev_free() (i.e., pcan_usb_fd_free or
>> pcan_usb_pro_free), how about the following path?
>>
>> peak_usb_probe
>> -> peak_usb_create_dev (goto adap_dev_free;)
>>    -> dev->adapter->dev_free()
>>       -> pcan_usb_fd_free or pcan_usb_pro_free (This function uses
>> next_siblings as condition elements)
>>
>> static void pcan_usb_fd_free(struct peak_usb_device *dev)
>> {
>>         /* last device: can free shared objects now */
>>         if (!dev->prev_siblings && !dev->next_siblings) {
>>                 struct pcan_usb_fd_device *pdev =
>>                         container_of(dev, struct pcan_usb_fd_device, dev);
>>
>>                 /* free commands buffer */
>>                 kfree(pdev->cmd_buffer_addr);
>>
>>                 /* free usb interface object */
>>                 kfree(pdev->usb_if);
>>         }
>> }
>>
>> If next_siblings is not NULL, will it lead to the missing free of
>> cmd_buffer_addr and usb_if?
> 
> The answer is No. Forget my silly thought.
> 

Yeah, it seems like (at least based on code), that this dangling pointer 
is not dangerous, since nothing accesses it. And next_siblings 
_guaranteed_ to be NULL, since dev->next_siblings is set NULL in 
disconnect()




With regards,
Pavel Skripkin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ