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]
Date:   Thu, 23 Mar 2023 08:36:55 +0100
From:   Horatiu Vultur <horatiu.vultur@...rochip.com>
To:     Liang He <windhl@....com>
CC:     <andrew@...n.ch>, <hkallweit1@...il.com>, <linux@...linux.org.uk>,
        <davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
        <pabeni@...hat.com>, <netdev@...r.kernel.org>,
        <david.daney@...ium.com>
Subject: Re: [PATCH] net: mdio: thunder: Add missing fwnode_handle_put()

The 03/23/2023 09:53, Liang He wrote:
> 
> At 2023-03-22 16:55:38, "Horatiu Vultur" <horatiu.vultur@...rochip.com> wrote:
> >The 03/22/2023 14:20, Liang He wrote:
> >>
> >> In device_for_each_child_node(), we should add fwnode_handle_put()
> >> when break out of the iteration device_for_each_child_node()
> >> as it will automatically increase and decrease the refcounter.
> >
> >Don't forget to mention the tree which you are targeting.
> >It shoud be something like:
> >"[PATCH net] net: mdio: thunder: Add missing fwnode_handle_put()" and
> >you can achieve this using option --subject-prefix when you create your
> >patch:
> >git format-patch ... --subject-prefix "PATCH net"
> >
> 
> Thanks for your reply and advise, I will add it in my future patches.
> 
> >
> >>
> >> Fixes: 379d7ac7ca31 ("phy: mdio-thunder: Add driver for Cavium Thunder SoC MDIO buses.")
> >> Signed-off-by: Liang He <windhl@....com>
> >> ---
> >>  drivers/net/mdio/mdio-thunder.c | 1 +
> >>  1 file changed, 1 insertion(+)
> >>
> >> diff --git a/drivers/net/mdio/mdio-thunder.c b/drivers/net/mdio/mdio-thunder.c
> >> index 822d2cdd2f35..394b864aaa37 100644
> >> --- a/drivers/net/mdio/mdio-thunder.c
> >> +++ b/drivers/net/mdio/mdio-thunder.c
> >> @@ -104,6 +104,7 @@ static int thunder_mdiobus_pci_probe(struct pci_dev *pdev,
> >>                 if (i >= ARRAY_SIZE(nexus->buses))
> >>                         break;
> >>         }
> >> +       fwnode_handle_put(fwn);
> >
> >Can you declare only 1 mdio bus in the DT under this pci device?
> >Because in that case, I don't think this is correct, because then
> >'device_for_each_child_node' will exit before all 4 mdio buses are probed.
> >And according to the comments for 'fwnode_handle_put' you need to use
> >with break or return.
> >
> 
> In fact, the fwnode_handle_put(fwn) consider the NULL-check of fwn, and
> there are only break, not return, so I think it can work in this case.
> However, if you prefer to add fwnode_handle_put before break, I can
> send a new patch.

You are right, fwnode_handle_put checks for NULL.
It is up too you how you prefer.

> 
> Thanks,
> Liang
> 
> >>         return 0;
> >>
> >>  err_release_regions:
> >> --
> >> 2.25.1
> >>
> >
> >--
> >/Horatiu

-- 
/Horatiu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ