]> git.baikalelectronics.ru Git - kernel.git/commit
bonding: Fix jiffies overflow problems (again)
authorJiri Bohac <jbohac@suse.cz>
Thu, 2 Sep 2010 05:45:54 +0000 (05:45 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 7 Sep 2010 20:57:20 +0000 (13:57 -0700)
commitd32dc1df58e6310ea36c5580ccac0961d5ef57d1
tree2f3762514e3feddb612c9d74379df98ac54eb300
parent75e1de2b8ecb8cf16728bf3a2ef8ec9f5f6d3399
bonding: Fix jiffies overflow problems (again)

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: Jiri Bohac <jbohac@suse.cz>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/bonding/bond_main.c