Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1352796 > unrolled thread

[PATCH] net: dsa: Fix cleanup resources upon module removal

Started byNeil Armstrong <narmstrong@baylibre.com>
First post2016-03-08 10:40 +0100
Last post2016-03-10 22:30 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH] net: dsa: Fix cleanup resources upon module removal Neil Armstrong <narmstrong@baylibre.com> - 2016-03-08 10:40 +0100
    Re: [PATCH] net: dsa: Fix cleanup resources upon module removal Andrew Lunn <andrew@lunn.ch> - 2016-03-08 16:00 +0100
    Re: [PATCH] net: dsa: Fix cleanup resources upon module removal David Miller <davem@davemloft.net> - 2016-03-10 22:30 +0100

#1352796 — [PATCH] net: dsa: Fix cleanup resources upon module removal

FromNeil Armstrong <narmstrong@baylibre.com>
Date2016-03-08 10:40 +0100
Subject[PATCH] net: dsa: Fix cleanup resources upon module removal
Message-ID<ramht-7tc-13@gated-at.bofh.it>
The initial commit badly merged into the dsa_resume method instead
of the dsa_remove_dst method.
As consequence, the dst->master_netdev->dsa_ptr is not set to NULL on
removal and re-bind of the dsa device fails with error -17.

Fixes: b0dc635d923c ("net: dsa: cleanup resources upon module removal ")
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 net/dsa/dsa.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

David, Florian, Andrew,

This fix is quite urgent since it breaks all the removal cleanup.

Thanks,
Neil

diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index fa4daba..d8fb47f 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -935,6 +935,14 @@ static void dsa_remove_dst(struct dsa_switch_tree *dst)
 {
 	int i;
 
+	dst->master_netdev->dsa_ptr = NULL;
+
+	/* If we used a tagging format that doesn't have an ethertype
+	 * field, make sure that all packets from this point get sent
+	 * without the tag and go through the regular receive path.
+	 */
+	wmb();
+
 	for (i = 0; i < dst->pd->nr_chips; i++) {
 		struct dsa_switch *ds = dst->ds[i];
 
@@ -988,14 +996,6 @@ static int dsa_suspend(struct device *d)
 	struct dsa_switch_tree *dst = platform_get_drvdata(pdev);
 	int i, ret = 0;
 
-	dst->master_netdev->dsa_ptr = NULL;
-
-	/* If we used a tagging format that doesn't have an ethertype
-	 * field, make sure that all packets from this point get sent
-	 * without the tag and go through the regular receive path.
-	 */
-	wmb();
-
 	for (i = 0; i < dst->pd->nr_chips; i++) {
 		struct dsa_switch *ds = dst->ds[i];
 
-- 
1.9.1

[toc] | [next] | [standalone]


#1353116

FromAndrew Lunn <andrew@lunn.ch>
Date2016-03-08 16:00 +0100
Message-ID<rarh8-2cP-1@gated-at.bofh.it>
In reply to#1352796
On Tue, Mar 08, 2016 at 10:36:20AM +0100, Neil Armstrong wrote:
> The initial commit badly merged into the dsa_resume method instead
> of the dsa_remove_dst method.
> As consequence, the dst->master_netdev->dsa_ptr is not set to NULL on
> removal and re-bind of the dsa device fails with error -17.
> 
> Fixes: b0dc635d923c ("net: dsa: cleanup resources upon module removal ")
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>

Acked-by: Andrew Lunn <andrew@lunn.ch>

Thanks

	Andrew

[toc] | [prev] | [next] | [standalone]


#1355412

FromDavid Miller <davem@davemloft.net>
Date2016-03-10 22:30 +0100
Message-ID<rbgjE-4mm-13@gated-at.bofh.it>
In reply to#1352796
From: Neil Armstrong <narmstrong@baylibre.com>
Date: Tue,  8 Mar 2016 10:36:20 +0100

> The initial commit badly merged into the dsa_resume method instead
> of the dsa_remove_dst method.
> As consequence, the dst->master_netdev->dsa_ptr is not set to NULL on
> removal and re-bind of the dsa device fails with error -17.
> 
> Fixes: b0dc635d923c ("net: dsa: cleanup resources upon module removal ")
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> ---
>  net/dsa/dsa.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> David, Florian, Andrew,
> 
> This fix is quite urgent since it breaks all the removal cleanup.

Since 'net' is closed, I've applied this to 'net-next' and queue it up for
-stable.

Thanks.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web