Skip to content

Commit 63fe33a

Browse files
einarjongregkh
authored andcommitted
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent bae49e7 commit 63fe33a

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/net/can/c_can/c_can_pci.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ static int c_can_pci_probe(struct pci_dev *pdev,
161161

162162
dev->irq = pdev->irq;
163163
priv->base = addr;
164+
priv->device = &pdev->dev;
164165

165166
if (!c_can_pci_data->freq) {
166167
dev_err(&pdev->dev, "no clock frequency defined\n");

0 commit comments

Comments
 (0)