linux-brain/net/can
Oliver Hartkopp 30e7517e83 can: bcm: check timer values before ktime conversion
commit 93171ba6f1 upstream.

Kyungtae Kim detected a potential integer overflow in bcm_[rx|tx]_setup()
when the conversion into ktime multiplies the given value with NSEC_PER_USEC
(1000).

Reference: https://marc.info/?l=linux-can&m=154732118819828&w=2

Add a check for the given tv_usec, so that the value stays below one second.
Additionally limit the tv_sec value to a reasonable value for CAN related
use-cases of 400 days and ensure all values to be positive.

Reported-by: Kyungtae Kim <kt0755@gmail.com>
Tested-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Cc: linux-stable <stable@vger.kernel.org> # >= 2.6.26
Tested-by: Kyungtae Kim <kt0755@gmail.com>
Acked-by: Andre Naujoks <nautsch2@gmail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-01-31 08:12:36 +01:00
..
Kconfig can: Kconfig: switch on all CAN protocolls by default 2013-01-26 16:58:58 +01:00
Makefile can: build proc support only if CONFIG_PROC_FS is activated 2016-06-17 15:39:41 +02:00
af_can.c can: af_can: canfd_rcv(): replace WARN_ONCE by pr_warn_once 2018-01-31 12:55:50 +01:00
af_can.h can: Fix kernel panic at security_sock_rcv_skb 2017-02-18 15:11:40 +01:00
bcm.c can: bcm: check timer values before ktime conversion 2019-01-31 08:12:36 +01:00
gw.c can: gw: ensure DLC boundaries after CAN frame modification 2019-01-23 08:10:53 +01:00
proc.c can: build proc support only if CONFIG_PROC_FS is activated 2016-06-17 15:39:41 +02:00
raw.c can: Fix kernel panic at security_sock_rcv_skb 2017-02-18 15:11:40 +01:00