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>] [day] [month] [year] [list]
Message-ID: <SL2PR06MB308280CD1F51C87B171D1F64BD759@SL2PR06MB3082.apcprd06.prod.outlook.com>
Date:   Tue, 14 Dec 2021 02:14:13 +0000
From:   王擎 <wangqing@...o.com>
To:     "Russell King (Oracle)" <linux@...linux.org.uk>
CC:     Andrew Lunn <andrew@...n.ch>,
        Heiner Kallweit <hkallweit1@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] net: phy: add missing of_node_put before return


>> From: Wang Qing <wangqing@...o.com>
>> 
>> Fix following coccicheck warning:
>> WARNING: Function "for_each_available_child_of_node" 
>> should have of_node_put() before return.
>> 
>> Early exits from for_each_available_child_of_node should decrement the
>> node reference counter.
>
>Most *definitely* NAK. Coccicheck is most definitely wrong on this one,
>and we will probably need some way to tell people not to believe
>coccicheck on this.
>
>In this path, the DT node is assigned to a struct device. This _must_
>be reference counted. device_set_node() does not increment the
>reference count, nor does of_fwnode_handle(). The reference count
>here is passed from this code over to the struct device.
>
>Adding an of_node_put() will break this.
>
>This must _never_ be "fixed" no matter how much coccicheck complains,
>as fixing the warning _will_ introduce a refcounting bug.
>
>I'll send a patch adding a comment to this effect.
>
>Thanks.

Yes, you are right. Maybe we can add a judgment in this cocci on which exit as expected 
or abnormally, only the latter needs to be reported.

Thanks,
Qing
>
>-- 
>RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
>FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ