diff mbox series

[net] net: dsa: fix switch tree list

Message ID 20191018210246.3018693-1-vivien.didelot@gmail.com
State Accepted
Delegated to: David Miller
Headers show
Series [net] net: dsa: fix switch tree list | expand

Commit Message

Vivien Didelot Oct. 18, 2019, 9:02 p.m. UTC
If there are multiple switch trees on the device, only the last one
will be listed, because the arguments of list_add_tail are swapped.

Fixes: 83c0afaec7b7 ("net: dsa: Add new binding implementation")
Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
---
 net/dsa/dsa2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Florian Fainelli Oct. 18, 2019, 11:33 p.m. UTC | #1
On 10/18/19 2:02 PM, Vivien Didelot wrote:
> If there are multiple switch trees on the device, only the last one
> will be listed, because the arguments of list_add_tail are swapped.
> 
> Fixes: 83c0afaec7b7 ("net: dsa: Add new binding implementation")
> Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

Nice catch!
David Miller Oct. 19, 2019, 7:20 p.m. UTC | #2
From: Vivien Didelot <vivien.didelot@gmail.com>
Date: Fri, 18 Oct 2019 17:02:46 -0400

> If there are multiple switch trees on the device, only the last one
> will be listed, because the arguments of list_add_tail are swapped.
> 
> Fixes: 83c0afaec7b7 ("net: dsa: Add new binding implementation")
> Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>

Applied and queued up for-stable, thanks Vivien.
diff mbox series

Patch

diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index 73002022c9d8..716d265ba8ca 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -46,7 +46,7 @@  static struct dsa_switch_tree *dsa_tree_alloc(int index)
 	dst->index = index;
 
 	INIT_LIST_HEAD(&dst->list);
-	list_add_tail(&dsa_tree_list, &dst->list);
+	list_add_tail(&dst->list, &dsa_tree_list);
 
 	kref_init(&dst->refcount);