Skip to content
  • Jiri Bohac's avatar
    bonding: Fix jiffies overflow problems (again) · cb32f2a0
    Jiri Bohac authored
    
    
    The time_before_eq()/time_after_eq() functions operate on unsigned
    long and only work if the difference between the two compared values
    is smaller than half the range of unsigned long (31 bits on i386).
    
    Some of the variables (slave->jiffies, dev->trans_start, dev->last_rx)
    used by bonding store a copy of jiffies and may not be updated for a
    long time. With HZ=1000, time_before_eq()/time_after_eq() will start
    giving bad results after ~25 days.
    
    jiffies will never be before slave->jiffies, dev->trans_start,
    dev->last_rx by more than possibly a couple ticks caused by preemption
    of this code. This allows us to detect/prevent these overflows by
    replacing time_before_eq()/time_after_eq() with time_in_range().
    
    Signed-off-by: default avatarJiri Bohac <jbohac@suse.cz>
    Signed-off-by: default avatarJean Delvare <jdelvare@suse.de>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    cb32f2a0