Message ID | 20220425094708.2769275-1-mw@semihalf.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net:] net: dsa: add missing refcount decrementation | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Clearly marked for net |
netdev/apply | fail | Patch does not apply to net |
On Mon, Apr 25, 2022 at 11:47:08AM +0200, Marcin Wojtas wrote: > After obtaining the "phy-handle" node, decrementing > refcount is required. Fix that. > > Fixes: a20f997010c4 ("net: dsa: Don't instantiate phylink for CPU/DSA ports unless needed") > Signed-off-by: Marcin Wojtas <mw@semihalf.com> > --- > net/dsa/port.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/net/dsa/port.c b/net/dsa/port.c > index 32d472a82241..cdc56ba11f52 100644 > --- a/net/dsa/port.c > +++ b/net/dsa/port.c > @@ -1620,8 +1620,10 @@ int dsa_port_link_register_of(struct dsa_port *dp) > if (ds->ops->phylink_mac_link_down) > ds->ops->phylink_mac_link_down(ds, port, > MLO_AN_FIXED, PHY_INTERFACE_MODE_NA); > + of_node_put(phy_np); > return dsa_port_phylink_register(dp); > } > + of_node_put(phy_np); > return 0; > } > > -- > 2.29.0 > Thanks for the patch. commit fc06b2867f4cea543505acfb194c2be4ebf0c7d3 Author: Miaoqian Lin <linmq006@gmail.com> Date: Wed Apr 20 19:04:08 2022 +0800 net: dsa: Add missing of_node_put() in dsa_port_link_register_of The device_node pointer is returned by of_parse_phandle() with refcount incremented. We should use of_node_put() on it when done. of_node_put() will check for NULL value. Fixes: a20f997010c4 ("net: dsa: Don't instantiate phylink for CPU/DSA ports unless needed") Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
śr., 27 kwi 2022 o 19:25 Vladimir Oltean <olteanv@gmail.com> napisał(a): > > On Mon, Apr 25, 2022 at 11:47:08AM +0200, Marcin Wojtas wrote: > > After obtaining the "phy-handle" node, decrementing > > refcount is required. Fix that. > > > > Fixes: a20f997010c4 ("net: dsa: Don't instantiate phylink for CPU/DSA ports unless needed") > > Signed-off-by: Marcin Wojtas <mw@semihalf.com> > > --- > > net/dsa/port.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/net/dsa/port.c b/net/dsa/port.c > > index 32d472a82241..cdc56ba11f52 100644 > > --- a/net/dsa/port.c > > +++ b/net/dsa/port.c > > @@ -1620,8 +1620,10 @@ int dsa_port_link_register_of(struct dsa_port *dp) > > if (ds->ops->phylink_mac_link_down) > > ds->ops->phylink_mac_link_down(ds, port, > > MLO_AN_FIXED, PHY_INTERFACE_MODE_NA); > > + of_node_put(phy_np); > > return dsa_port_phylink_register(dp); > > } > > + of_node_put(phy_np); > > return 0; > > } > > > > -- > > 2.29.0 > > > > Thanks for the patch. > > commit fc06b2867f4cea543505acfb194c2be4ebf0c7d3 > Author: Miaoqian Lin <linmq006@gmail.com> > Date: Wed Apr 20 19:04:08 2022 +0800 > > net: dsa: Add missing of_node_put() in dsa_port_link_register_of > > The device_node pointer is returned by of_parse_phandle() with refcount > incremented. We should use of_node_put() on it when done. > of_node_put() will check for NULL value. > > Fixes: a20f997010c4 ("net: dsa: Don't instantiate phylink for CPU/DSA ports unless needed") > Signed-off-by: Miaoqian Lin <linmq006@gmail.com> > Signed-off-by: David S. Miller <davem@davemloft.net> Great, I'll rebase then and I can drop my patch. Thanks, Marcin
diff --git a/net/dsa/port.c b/net/dsa/port.c index 32d472a82241..cdc56ba11f52 100644 --- a/net/dsa/port.c +++ b/net/dsa/port.c @@ -1620,8 +1620,10 @@ int dsa_port_link_register_of(struct dsa_port *dp) if (ds->ops->phylink_mac_link_down) ds->ops->phylink_mac_link_down(ds, port, MLO_AN_FIXED, PHY_INTERFACE_MODE_NA); + of_node_put(phy_np); return dsa_port_phylink_register(dp); } + of_node_put(phy_np); return 0; }
After obtaining the "phy-handle" node, decrementing refcount is required. Fix that. Fixes: a20f997010c4 ("net: dsa: Don't instantiate phylink for CPU/DSA ports unless needed") Signed-off-by: Marcin Wojtas <mw@semihalf.com> --- net/dsa/port.c | 2 ++ 1 file changed, 2 insertions(+)