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: <b8b24b65-786b-2a4e-5548-5e5e8bf988be@metafoo.de>
Date:   Mon, 13 Dec 2021 20:43:14 +0100
From:   Lars-Peter Clausen <lars@...afoo.de>
To:     Tanmay Shah <tanmay.shah@...inx.com>,
        Bjorn Andersson <bjorn.andersson@...aro.org>,
        Mathieu Poirier <mathieu.poirier@...aro.org>,
        Rob Herring <robh+dt@...nel.org>,
        Michal Simek <michal.simek@...inx.com>
Cc:     Laurent Pinchart <laurent.pinchart@...asonboard.com>,
        Ben Levinsky <ben.levinsky@...inx.com>,
        Bill Mills <bill.mills@...aro.org>,
        Sergei Korneichuk <sergei.korneichuk@...inx.com>,
        linux-remoteproc@...r.kernel.org, linux-kernel@...r.kernel.org,
        devicetree@...r.kernel.org, linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v2 6/6] drivers: remoteproc: Add Xilinx r5 remoteproc
 driver

On 12/13/21 8:31 PM, Tanmay Shah wrote:
>>> +static int zynqmp_r5_cluster_init(struct zynqmp_r5_cluster *cluster)
>>> +{
>>> [...]
>>> +
>>>
>>> +    i = 0;
>>> +    for_each_available_child_of_node(dev_node, child) {
>>> +        child_pdev = of_find_device_by_node(child);
>>> +        if (!child_pdev)
>> A return or a break in a for_each_available_child_of_node() will leak 
>> the reference to the child node.
>
> Do you mean I have to use of_put_node for each child?

You have to put a `of_put_node(child)` before each break or return in 
the loop.

If you search the kernel commit history for 
for_each_available_child_of_node or for_each_child_of_node you'll find 
many fixes for similar problems. For example 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e1b391e9712db

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ