lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20171103230530.996-8-vivien.didelot@savoirfairelinux.com>
Date:   Fri,  3 Nov 2017 19:05:26 -0400
From:   Vivien Didelot <vivien.didelot@...oirfairelinux.com>
To:     netdev@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org, kernel@...oirfairelinux.com,
        "David S. Miller" <davem@...emloft.net>,
        Florian Fainelli <f.fainelli@...il.com>,
        Andrew Lunn <andrew@...n.ch>,
        Vivien Didelot <vivien.didelot@...oirfairelinux.com>
Subject: [PATCH net-next 07/11] net: dsa: get tree before parsing ports

We will need a reference to the dsa_switch_tree when parsing a CPU port,
so fetch it right after parsing the member and before parsing ports.

Signed-off-by: Vivien Didelot <vivien.didelot@...oirfairelinux.com>
---
 net/dsa/dsa2.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index 5b6a3dad8015..5918fbddb0ab 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -751,18 +751,10 @@ static int _dsa_register_switch(struct dsa_switch *ds)
 		err = dsa_parse_member_dn(np, &tree, &index);
 		if (err)
 			return err;
-
-		err = dsa_parse_ports_of(np, ds);
-		if (err)
-			return err;
 	} else {
 		err = dsa_parse_member(pdata, &tree, &index);
 		if (err)
 			return err;
-
-		err = dsa_parse_ports(pdata, ds);
-		if (err)
-			return err;
 	}
 
 	dst = dsa_tree_touch(tree);
@@ -773,6 +765,16 @@ static int _dsa_register_switch(struct dsa_switch *ds)
 	ds->index = index;
 	ds->cd = pdata;
 
+	if (np) {
+		err = dsa_parse_ports_of(np, ds);
+		if (err)
+			return err;
+	} else {
+		err = dsa_parse_ports(pdata, ds);
+		if (err)
+			return err;
+	}
+
 	/* Initialize the routing table */
 	for (i = 0; i < DSA_MAX_SWITCHES; ++i)
 		ds->rtable[i] = DSA_RTABLE_NONE;
-- 
2.14.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ