]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
can: c_can_pci: c_can_pci_remove(): fix use-after-free
authorTong Zhang <ztong0001@gmail.com>
Mon, 1 Mar 2021 02:45:11 +0000 (21:45 -0500)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Tue, 16 Mar 2021 07:41:27 +0000 (08:41 +0100)
commit0429d6d89f97ebff4f17f13f5b5069c66bde8138
treea9eca01ded1810a2165a1cee06fb359711c58b2b
parent7507479c46b120c37ef83e59be7683a526e98e1a
can: c_can_pci: c_can_pci_remove(): fix use-after-free

There is a UAF in c_can_pci_remove(). dev is released by
free_c_can_dev() and is used by pci_iounmap(pdev, priv->base) later.
To fix this issue, save the mmio address before releasing dev.

Fixes: 5b92da0443c2 ("c_can_pci: generic module for C_CAN/D_CAN on PCI")
Link: https://lore.kernel.org/r/20210301024512.539039-1-ztong0001@gmail.com
Signed-off-by: Tong Zhang <ztong0001@gmail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/c_can/c_can_pci.c