aboutsummaryrefslogtreecommitdiffstats
path: root/net/dsa/dsa_priv.h
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2015-02-24 16:15:32 -0500
committerDavid S. Miller <davem@davemloft.net>2015-02-25 17:03:38 -0500
commitd87d6f44d7c1254fd9560a5191659cb00882db56 (patch)
treeedc80a71daf91645aa2e74a798f97a9fd836a35a /net/dsa/dsa_priv.h
parent92bf200881d978bc3c6a290991ae1f9ddc7b5411 (diff)
net: dsa: Ensure that port array elements are initialized before being used
A network device notifier can be called for one or more of the created slave devices before all slave devices have been registered. This can result in a mismatch between ds->phys_port_mask and the registered devices by the time the call is made, and it can result in a slave device being added to a bridge before its entry in ds->ports[] has been initialized. Rework the initialization code to initialize entries in ds->ports[] in dsa_slave_create. With this change, dsa_slave_create no longer needs to return slave_dev but can return an error code instead. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa/dsa_priv.h')
-rw-r--r--net/dsa/dsa_priv.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index dc9756d3154c..7eb1a6acd46c 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -53,9 +53,8 @@ extern char dsa_driver_version[];
53/* slave.c */ 53/* slave.c */
54extern const struct dsa_device_ops notag_netdev_ops; 54extern const struct dsa_device_ops notag_netdev_ops;
55void dsa_slave_mii_bus_init(struct dsa_switch *ds); 55void dsa_slave_mii_bus_init(struct dsa_switch *ds);
56struct net_device *dsa_slave_create(struct dsa_switch *ds, 56int dsa_slave_create(struct dsa_switch *ds, struct device *parent,
57 struct device *parent, 57 int port, char *name);
58 int port, char *name);
59int dsa_slave_suspend(struct net_device *slave_dev); 58int dsa_slave_suspend(struct net_device *slave_dev);
60int dsa_slave_resume(struct net_device *slave_dev); 59int dsa_slave_resume(struct net_device *slave_dev);
61 60