Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1258782 > unrolled thread
| Started by | Neil Armstrong <narmstrong@baylibre.com> |
|---|---|
| First post | 2015-10-29 14:30 +0100 |
| Last post | 2015-10-29 15:10 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH v2 5/6] net: dsa: add missing calls in dsa_switch_destroy Neil Armstrong <narmstrong@baylibre.com> - 2015-10-29 14:30 +0100
Re: [PATCH v2 5/6] net: dsa: add missing calls in dsa_switch_destroy Andrew Lunn <andrew@lunn.ch> - 2015-10-29 15:10 +0100
Re: [PATCH v2 5/6] net: dsa: add missing calls in dsa_switch_destroy Neil Armstrong <narmstrong@baylibre.com> - 2015-10-29 15:10 +0100
| From | Neil Armstrong <narmstrong@baylibre.com> |
|---|---|
| Date | 2015-10-29 14:30 +0100 |
| Subject | [PATCH v2 5/6] net: dsa: add missing calls in dsa_switch_destroy |
| Message-ID | <qoVrc-Hx-7@gated-at.bofh.it> |
Add missing netif_carrier_off and phy_disconnect calls to the dsa_switch_destroy function to make sure the netdev and phy ressources are clean before complete removal. Signed-off-by: Frode Isaksen <fisaksen@baylibre.com> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> --- net/dsa/dsa.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index 597a462..11452e4 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c @@ -454,7 +454,9 @@ static void dsa_switch_destroy(struct dsa_switch *ds) if (!ds->ports[port]) continue; + netif_carrier_off(ds->ports[port]); unregister_netdev(ds->ports[port]); + phy_disconnect(p->phy); free_netdev(ds->ports[port]); } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Andrew Lunn <andrew@lunn.ch> |
|---|---|
| Date | 2015-10-29 15:10 +0100 |
| Message-ID | <qoW3T-1al-1@gated-at.bofh.it> |
| In reply to | #1258782 |
On Thu, Oct 29, 2015 at 02:23:25PM +0100, Neil Armstrong wrote: > Add missing netif_carrier_off and phy_disconnect calls to the > dsa_switch_destroy function to make sure the netdev and phy > ressources are clean before complete removal. > > Signed-off-by: Frode Isaksen <fisaksen@baylibre.com> > Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> > --- > net/dsa/dsa.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c > index 597a462..11452e4 100644 > --- a/net/dsa/dsa.c > +++ b/net/dsa/dsa.c > @@ -454,7 +454,9 @@ static void dsa_switch_destroy(struct dsa_switch *ds) > if (!ds->ports[port]) > continue; > > + netif_carrier_off(ds->ports[port]); > unregister_netdev(ds->ports[port]); > + phy_disconnect(p->phy); > free_netdev(ds->ports[port]); > } Once you make it actually compile.... I'm not sure this is safe. The loop above this one has just destroyed some phys, and now you are potentially disconnecting a phy you just destroyed, causing it to be accessed? I would suggest you first fix the ordering in dsa_switch_destroy() and then add the missing netif_carrier_off() and phy_disconnect(). Thanks Andrew -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Neil Armstrong <narmstrong@baylibre.com> |
|---|---|
| Date | 2015-10-29 15:10 +0100 |
| Message-ID | <qoW3U-1al-13@gated-at.bofh.it> |
| In reply to | #1258807 |
On 10/29/2015 03:00 PM, Andrew Lunn wrote: > On Thu, Oct 29, 2015 at 02:23:25PM +0100, Neil Armstrong wrote: >> >> + netif_carrier_off(ds->ports[port]); >> unregister_netdev(ds->ports[port]); >> + phy_disconnect(p->phy); >> free_netdev(ds->ports[port]); >> } > > Once you make it actually compile.... > > I'm not sure this is safe. The loop above this one has just destroyed > some phys, and now you are potentially disconnecting a phy you just > destroyed, causing it to be accessed? > > I would suggest you first fix the ordering in dsa_switch_destroy() > and then add the missing netif_carrier_off() and phy_disconnect(). > > Thanks > Andrew > Yes, you are right, I will submit a cleaned up version. I forgot the fixed phy case actually. Thanks, Neil -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web