Re: [PATCH v1] can: c_can: fix null-ptr-deref on ioctl()

From: Marc Kleine-Budde
Date: Tue Sep 07 2021 - 02:39:17 EST


On 06.09.2021 16:37:02, Tong Zhang wrote:
> the pdev maybe not a platform device, e.g. c_can_pci device,
> in this case, calling to_platform_device() would not make sense.
> Also, per the comment in drivers/net/can/c_can/c_can_ethtool.c, @bus_info
> sould match dev_name() string, so I am replacing this with dev_name() to
^^^^^
should

Fixed while applying.

> fix this issue.
>
> [ 1.458583] BUG: unable to handle page fault for address: 0000000100000000
> [ 1.460921] RIP: 0010:strnlen+0x1a/0x30
> [ 1.466336] ? c_can_get_drvinfo+0x65/0xb0 [c_can]
> [ 1.466597] ethtool_get_drvinfo+0xae/0x360
> [ 1.466826] dev_ethtool+0x10f8/0x2970
> [ 1.467880] sock_ioctl+0xef/0x300
>
> Fixes: 2722ac986e93 ("can: c_can: add ethtool support")
> Signed-off-by: Tong Zhang <ztong0001@xxxxxxxxx>

Applied to linux-can/testing + added stable on Cc.

regards,
Marc

--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |

Attachment: signature.asc
Description: PGP signature