• Yanguo Li's avatar
    nfp: flower: avoid rmmod nfp crash issues · 14690995
    Yanguo Li authored
    When there are CT table entries, and you rmmod nfp, the following
    events can happen:
    
    task1:
        nfp_net_pci_remove
              ↓
        nfp_flower_stop->(asynchronous)tcf_ct_flow_table_cleanup_work(3)
              ↓
        nfp_zone_table_entry_destroy(1)
    
    task2:
        nfp_fl_ct_handle_nft_flow(2)
    
    When the execution order is (1)->(2)->(3), it will crash. Therefore, in
    the function nfp_fl_ct_del_flow, nf_flow_table_offload_del_cb needs to
    be executed synchronously.
    
    At the same time, in order to solve the deadlock problem and the problem
    of rtnl_lock sometimes failing, replace rtnl_lock with the private
    nfp_fl_lock.
    
    Fixes: 7cc93d88 ("nfp: flower-ct: remove callback delete deadlock")
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarYanguo Li <yanguo.li@corigine.com>
    Signed-off-by: default avatarLouis Peens <louis.peens@corigine.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    14690995
offload.c 55.9 KB