Skip to content
  • Harald Welte's avatar
    [NETFILTER] Fix conntrack event cache deadlock/oops · 1dfbab59
    Harald Welte authored
    
    
    This patch fixes a number of bugs.  It cannot be reasonably split up in
    multiple fixes, since all bugs interact with each other and affect the same
    function:
    
    Bug #1:
    The event cache code cannot be called while a lock is held.  Therefore, the
    call to ip_conntrack_event_cache() within ip_ct_refresh_acct() needs to be
    moved outside of the locked section.  This fixes a number of 2.6.14-rcX
    oops and deadlock reports.
    
    Bug #2:
    We used to call ct_add_counters() for unconfirmed connections without
    holding a lock.  Since the add operations are not atomic, we could race
    with another CPU.
    
    Bug #3:
    ip_ct_refresh_acct() lost REFRESH events in some cases where refresh
    (and the corresponding event) are desired, but no accounting shall be
    performed.  Both, evenst and accounting implicitly depended on the skb
    parameter bein non-null.   We now re-introduce a non-accounting
    "ip_ct_refresh()" variant to explicitly state the desired behaviour.
    
    Signed-off-by: default avatarHarald Welte <laforge@netfilter.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    1dfbab59