ppdev: fix PPGETTIME/PPSETTIME ioctls
authorArnd Bergmann <arnd@arndb.de>
Fri, 8 Nov 2019 20:34:30 +0000 (21:34 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 17 Dec 2019 19:39:39 +0000 (20:39 +0100)
commit5a963f7589ba8f2af0089608e414059196f92dd7
treed0ef7b83670c6f8c381ab1d6c35a5c8a76fe4354
parent822e1ba45f4879184fc17b4a0246da71d771f7e3
ppdev: fix PPGETTIME/PPSETTIME ioctls

commit 998174042da229e2cf5841f574aba4a743e69650 upstream.

Going through the uses of timeval in the user space API,
I noticed two bugs in ppdev that were introduced in the y2038
conversion:

* The range check was accidentally moved from ppsettime to
  ppgettime

* On sparc64, the microseconds are in the other half of the
  64-bit word.

Fix both, and mark the fix for stable backports.

Cc: stable@vger.kernel.org
Fixes: 3b9ab374a1e6 ("ppdev: convert to y2038 safe")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20191108203435.112759-8-arnd@arndb.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/ppdev.c