aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire/core-card.c
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2011-01-22 09:05:03 -0500
committerStefan Richter <stefanr@s5r6.in-berlin.de>2011-01-23 06:31:01 -0500
commite71084af58cf15e6043338500eeaf6281d0a62af (patch)
treed757d4891a4f93f7a07c1f12448d3be3be748fa1 /drivers/firewire/core-card.c
parentdbc9880fa731fe2482a706bbabb4165269233063 (diff)
firewire: core: fix card->reset_jiffies overflow
On a 32-bit machine with, e.g., HZ=1000, jiffies will overflow after about 50 days, so if there are between 25 and 50 days between bus resets, the card->reset_jiffies comparisons can get wrong results. To fix this, ensure that this timestamp always uses 64 bits. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: "Stefan Richter" <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire/core-card.c')
-rw-r--r--drivers/firewire/core-card.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/firewire/core-card.c b/drivers/firewire/core-card.c
index 24ff35511e2b..3241dc4e1fc9 100644
--- a/drivers/firewire/core-card.c
+++ b/drivers/firewire/core-card.c
@@ -233,7 +233,7 @@ static void br_work(struct work_struct *work)
233 233
234 /* Delay for 2s after last reset per IEEE 1394 clause 8.2.1. */ 234 /* Delay for 2s after last reset per IEEE 1394 clause 8.2.1. */
235 if (card->reset_jiffies != 0 && 235 if (card->reset_jiffies != 0 &&
236 time_is_after_jiffies(card->reset_jiffies + 2 * HZ)) { 236 time_before64(get_jiffies_64(), card->reset_jiffies + 2 * HZ)) {
237 if (!schedule_delayed_work(&card->br_work, 2 * HZ)) 237 if (!schedule_delayed_work(&card->br_work, 2 * HZ))
238 fw_card_put(card); 238 fw_card_put(card);
239 return; 239 return;
@@ -316,7 +316,8 @@ static void bm_work(struct work_struct *work)
316 irm_id = card->irm_node->node_id; 316 irm_id = card->irm_node->node_id;
317 local_id = card->local_node->node_id; 317 local_id = card->local_node->node_id;
318 318
319 grace = time_after(jiffies, card->reset_jiffies + DIV_ROUND_UP(HZ, 8)); 319 grace = time_after64(get_jiffies_64(),
320 card->reset_jiffies + DIV_ROUND_UP(HZ, 8));
320 321
321 if ((is_next_generation(generation, card->bm_generation) && 322 if ((is_next_generation(generation, card->bm_generation) &&
322 !card->bm_abdicate) || 323 !card->bm_abdicate) ||