]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
staging: comedi: jr3_pci: cope with jiffies wraparound
authorIan Abbott <abbotti@mev.co.uk>
Fri, 17 Feb 2017 11:09:09 +0000 (11:09 +0000)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 20 Jun 2017 08:50:15 +0000 (10:50 +0200)
BugLink: http://bugs.launchpad.net/bugs/1692898
commit 8ec04a491825e08068e92bed0bba7821893b6433 upstream.

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.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/staging/comedi/drivers/jr3_pci.c

index 25909a936e7c0a7fad8578c55d09de3dcd89567f..eb0a095efe9cd6c0860bd027915112d3cb7ae417 100644 (file)
@@ -611,7 +611,7 @@ static void jr3_pci_poll_dev(unsigned long data)
                s = &dev->subdevices[i];
                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;
 
                        sub_delay = jr3_pci_poll_subdevice(s);