Skip to content
  • Patrick McHardy's avatar
    [NETFILTER]: Fix multiple problems with the conntrack event cache · a86888b9
    Patrick McHardy authored
    
    
    refcnt underflow: the reference count is decremented when a conntrack
    entry is removed from the hash but it is not incremented when entering
    new entries.
    
    missing protection of process context against softirq context: all
    cache operations need to locally disable softirqs to avoid races.
    Additionally the event cache can't be initialized when a packet
    enteres the conntrack code but needs to be initialized whenever we
    cache an event and the stored conntrack entry doesn't match the
    current one.
    
    incorrect flushing of the event cache in ip_ct_iterate_cleanup:
    without real locking we can't flush the cache for different CPUs
    without incurring races. The cache for different CPUs can only be
    flushed when no packets are going through the
    code. ip_ct_iterate_cleanup doesn't need to drop all references, so
    flushing is moved to the cleanup path.
    
    Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    a86888b9