summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorEinar Jón <tolvupostur@gmail.com>2016-08-12 13:50:41 +0200
committerBen Hutchings <ben@decadent.org.uk>2017-03-16 02:27:00 +0000
commitdc4392e9e80e1c69ecc263ebbbf88faa7a0100cb (patch)
tree12e25fc33c27263f987882057717ef1908382933 /drivers/net
parent9a7ed2f246d6665b729b5b799adb3dafe40dd219 (diff)
downloadlinux-stable-dc4392e9e80e1c69ecc263ebbbf88faa7a0100cb.tar.gz
linux-stable-dc4392e9e80e1c69ecc263ebbbf88faa7a0100cb.tar.bz2
linux-stable-dc4392e9e80e1c69ecc263ebbbf88faa7a0100cb.zip
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: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/can/c_can/c_can_pci.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/net/can/c_can/c_can_pci.c b/drivers/net/can/c_can/c_can_pci.c
index 5d11e0e4225b..b997508ea7c6 100644
--- a/drivers/net/can/c_can/c_can_pci.c
+++ b/drivers/net/can/c_can/c_can_pci.c
@@ -161,6 +161,7 @@ static int c_can_pci_probe(struct pci_dev *pdev,
dev->irq = pdev->irq;
priv->base = addr;
+ priv->device = &pdev->dev;
if (!c_can_pci_data->freq) {
dev_err(&pdev->dev, "no clock frequency defined\n");