• Julian Wiedmann's avatar
    s390/qeth: fix race when setting MAC address · 4789a218
    Julian Wiedmann authored
    When qeth_l2_set_mac_address() finds the card in a non-reachable state,
    it merely copies the new MAC address into dev->dev_addr so that
    __qeth_l2_set_online() can later register it with the HW.
    
    But __qeth_l2_set_online() may very well be running concurrently, so we
    can't trust the card state without appropriate locking:
    If the online sequence is past the point where it registers
    dev->dev_addr (but not yet in SOFTSETUP state), any address change needs
    to be properly programmed into the HW. Otherwise the netdevice ends up
    with a different MAC address than what's set in the HW, and inbound
    traffic is not forwarded as expected.
    
    This is most likely to occur for OSD in LPAR, where
    commit 21b1702a ("s390/qeth: improve fallback to random MAC address")
    now triggers eg. systemd to immediately change the MAC when the netdevice
    is registered with a NET_ADDR_RANDOM address.
    
    Fixes: bcacfcbc ("s390/qeth: fix MAC address update sequence")
    Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    4789a218
qeth_l2_main.c 67.3 KB