• Guenter Roeck's avatar
    net: dsa: Ensure that port array elements are initialized before being used · d87d6f44
    Guenter Roeck authored
    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: default avatarGuenter Roeck <linux@roeck-us.net>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    d87d6f44
dsa.c 19 KB