Skip to contentSkip to conversation

Patch "can: c_can_pci: fix null-pointer-deref in c_can_start() - set device pointer" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Jan 30, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

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

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
can-c_can_pci-fix-null-pointer-deref-in-c_can_start-set-device-pointer.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From c97c52be78b8463ac5407f1cf1f22f8f6cf93a37 Mon Sep 17 00:00:00 2001

From: =?UTF-8?q?Einar=20J=C3=B3n?= <[email protected]>
Date: Fri, 12 Aug 2016 13:50:41 +0200
Subject: can: c_can_pci: fix null-pointer-deref in c_can_start() - set device pointer
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

From: Einar Jón <[email protected]>

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.

---
 drivers/net/can/c_can/c_can_pci.c |    1 +
 1 file changed, 1 insertion(+)
drivers/net/can/c_can/c_can_pci.c +1 -0
@@ -161,6 +161,7 @@ static int c_can_pci_probe(struct pci_de
 
 	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");

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/can-c_can_pci-fix-null-pointer-deref-in-c_can_start-set-device-pointer.patch