Commit 6842c845 authored by Ian Abbott's avatar Ian Abbott Committed by Sasha Levin

staging: comedi: jr3_pci: cope with jiffies wraparound

[ Upstream commit 8ec04a49 ]

The timer expiry routine `jr3_pci_poll_dev()` checks for expiry by
checking whether the absolute value of `jiffies` (stored in local
variable `now`) is greater than the expected expiry time in jiffy units.
This will fail when `jiffies` wraps around.  Also, it seems to make
sense to handle the expiry one jiffy earlier than the current test.  Use
`time_after_eq()` to check for expiry.

Cc: <stable@vger.kernel.org> # 3.15+
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
parent 29e34e47
...@@ -610,7 +610,7 @@ static void jr3_pci_poll_dev(unsigned long data) ...@@ -610,7 +610,7 @@ static void jr3_pci_poll_dev(unsigned long data)
s = &dev->subdevices[i]; s = &dev->subdevices[i];
spriv = s->private; spriv = s->private;
if (now > spriv->next_time_min) { if (time_after_eq(now, spriv->next_time_min)) {
struct jr3_pci_poll_delay sub_delay; struct jr3_pci_poll_delay sub_delay;
sub_delay = jr3_pci_poll_subdevice(s); sub_delay = jr3_pci_poll_subdevice(s);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment