Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1597705 > unrolled thread

[PATCH 3.16 233/370] can: c_can_pci: fix null-pointer-deref in c_can_start() - set device pointer

Started byBen Hutchings <ben@decadent.org.uk>
First post2017-03-10 15:00 +0100
Last post2017-03-10 15:00 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3.16 233/370] can: c_can_pci: fix null-pointer-deref in  c_can_start() - set device pointer Ben Hutchings <ben@decadent.org.uk> - 2017-03-10 15:00 +0100

#1597705 — [PATCH 3.16 233/370] can: c_can_pci: fix null-pointer-deref in c_can_start() - set device pointer

FromBen Hutchings <ben@decadent.org.uk>
Date2017-03-10 15:00 +0100
Subject[PATCH 3.16 233/370] can: c_can_pci: fix null-pointer-deref in c_can_start() - set device pointer
Message-ID<tjtfl-4NB-53@gated-at.bofh.it>
3.16.42-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Einar Jón <tolvupostur@gmail.com>

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>
---
 drivers/net/can/c_can/c_can_pci.c | 1 +
 1 file changed, 1 insertion(+)

--- 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_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");

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web