• Rafał Miłecki's avatar
    brcmfmac: delete interface directly in code that sent fw request · a63b0987
    Rafał Miłecki authored
    So far when receiving event about in-firmware-interface removal our
    event worker was notifying listener and afterwards it was removing Linux
    interface.
    
    First of all it was resulting in slightly unexpected order. The listener
    (del_virtual_intf callback) was (usually) returning with success before
    we even called unregister_netdev(ice).
    
    Please note this couldn't be simply fixed by changing order of calls in
    brcmf_fweh_handle_if_event as unregistering interface earlier could free
    struct brcmf_if.
    
    Another problem of current implementation are possible lockups. Focus on
    the time slot between calling event handler and removing Linux
    interface. During that time original caller may leave (unlocking rtnl
    semaphore) *and* another call to the same code may be done (locking it
    again). If that happens our event handler will stuck at removing Linux
    interface, it won't handle another event and will block process holding
    rtnl lock.
    
    This can be simply solved by unregistering interface in a proper
    callback, right after receiving confirmation event from firmware. This
    only required modifying worker to don't unregister on its own if there
    is someone waiting for the event.
    Signed-off-by: default avatarRafał Miłecki <zajec5@gmail.com>
    Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
    a63b0987
fweh.c 12.1 KB