can: c_can_pci: fix null-pointer-deref in c_can_start() - set device pointer
authorEinar Jón <tolvupostur@gmail.com>
Fri, 12 Aug 2016 11:50:41 +0000 (13:50 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Feb 2017 07:33:08 +0000 (08:33 +0100)
commit9f56548b007769191f7dff7585eb317369991c22
treec411afdd97053bc542cd150a3f304c3fbde8bf5f
parenta1af471b4151176e26330d3c4a9589711866e2b1
can: c_can_pci: fix null-pointer-deref in c_can_start() - set device pointer

commit c97c52be78b8463ac5407f1cf1f22f8f6cf93a37 upstream.

The priv->device pointer for c_can_pci is never set, but it is used
without a NULL check in c_can_start(). Setting it in c_can_pci_probe()
like c_can_plat_probe() prevents c_can_pci.ko from crashing, with and
without CONFIG_PM.

This might also cause the pm_runtime_*() functions in c_can.c to
actually be executed for c_can_pci devices - they are the only other
place where priv->device is used, but they all contain a null check.

Signed-off-by: Einar Jón <tolvupostur@gmail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/can/c_can/c_can_pci.c