net: dsa: fix switch tree list
authorVivien Didelot <vivien.didelot@gmail.com>
Fri, 18 Oct 2019 21:02:46 +0000 (17:02 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 10 Nov 2019 10:23:26 +0000 (11:23 +0100)
[ Upstream commit 50c7d2ba9de20f60a2d527ad6928209ef67e4cdd ]

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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/dsa/dsa2.c

index 0f99297b2fb3517942bf74fee08ed3e61d65a4f0..f1792a847d0bec510fbd1f2607448eb45d851bd8 100644 (file)
@@ -59,7 +59,7 @@ static struct dsa_switch_tree *dsa_add_dst(u32 tree)
        dst->tree = tree;
        dst->cpu_switch = -1;
        INIT_LIST_HEAD(&dst->list);
-       list_add_tail(&dsa_switch_trees, &dst->list);
+       list_add_tail(&dst->list, &dsa_switch_trees);
        kref_init(&dst->refcount);
 
        return dst;