Skip to content
  • Florian Westphal's avatar
    netfilter: nf_tables: fix module unload race · 71ad00c5
    Florian Westphal authored
    
    
    We must first remove the nfnetlink protocol handler when nf_tables module
    is unloaded -- we don't want userspace to submit new change requests once
    we've started to tear down nft state.
    
    Furthermore, nfnetlink must not call any subsystem function after
    call_batch returned -EAGAIN.
    
    EAGAIN means the subsys mutex was dropped, so its unlikely but possible that
    nf_tables subsystem was removed due to 'rmmod nf_tables' on another cpu.
    
    Therefore, we must abort batch completely and not move on to next part of
    the batch.
    
    Last, we can't invoke ->abort unless we've checked that the subsystem is
    still registered.
    
    Change netns exit path of nf_tables to make sure any incompleted
    transaction gets removed on exit.
    
    Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
    Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
    71ad00c5