]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.4.46/can-c_can_pci-fix-null-pointer-deref-in-c_can_start-set-device-pointer.patch
drop drm patch
[thirdparty/kernel/stable-queue.git] / releases / 4.4.46 / can-c_can_pci-fix-null-pointer-deref-in-c_can_start-set-device-pointer.patch
CommitLineData
a2acf6ef
GKH
1From c97c52be78b8463ac5407f1cf1f22f8f6cf93a37 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Einar=20J=C3=B3n?= <tolvupostur@gmail.com>
3Date: Fri, 12 Aug 2016 13:50:41 +0200
4Subject: can: c_can_pci: fix null-pointer-deref in c_can_start() - set device pointer
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9From: Einar Jón <tolvupostur@gmail.com>
10
11commit c97c52be78b8463ac5407f1cf1f22f8f6cf93a37 upstream.
12
13The priv->device pointer for c_can_pci is never set, but it is used
14without a NULL check in c_can_start(). Setting it in c_can_pci_probe()
15like c_can_plat_probe() prevents c_can_pci.ko from crashing, with and
16without CONFIG_PM.
17
18This might also cause the pm_runtime_*() functions in c_can.c to
19actually be executed for c_can_pci devices - they are the only other
20place where priv->device is used, but they all contain a null check.
21
22Signed-off-by: Einar Jón <tolvupostur@gmail.com>
23Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
24Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25
26---
27 drivers/net/can/c_can/c_can_pci.c | 1 +
28 1 file changed, 1 insertion(+)
29
30--- a/drivers/net/can/c_can/c_can_pci.c
31+++ b/drivers/net/can/c_can/c_can_pci.c
32@@ -161,6 +161,7 @@ static int c_can_pci_probe(struct pci_de
33
34 dev->irq = pdev->irq;
35 priv->base = addr;
36+ priv->device = &pdev->dev;
37
38 if (!c_can_pci_data->freq) {
39 dev_err(&pdev->dev, "no clock frequency defined\n");