Commit c97c52be authored by Einar Jón's avatar Einar Jón Committed by Marc Kleine-Budde

can: c_can_pci: fix null-pointer-deref in c_can_start() - set device pointer

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: default avatarEinar Jón <tolvupostur@gmail.com>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 93b43fd1
...@@ -161,6 +161,7 @@ static int c_can_pci_probe(struct pci_dev *pdev, ...@@ -161,6 +161,7 @@ static int c_can_pci_probe(struct pci_dev *pdev,
dev->irq = pdev->irq; dev->irq = pdev->irq;
priv->base = addr; priv->base = addr;
priv->device = &pdev->dev;
if (!c_can_pci_data->freq) { if (!c_can_pci_data->freq) {
dev_err(&pdev->dev, "no clock frequency defined\n"); dev_err(&pdev->dev, "no clock frequency defined\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment