Re: RE: [PATCH can 4/4] can: rcar_canfd: rcar_canfd_probe(): reject devices without match data
From: Marc Kleine-Budde
Date: Mon Nov 16 2026 - 04:02:49 EST
On 16.11.2026 08:39:36, Biju Das wrote:
> Hi Marc,
>
> > -----Original Message-----
> > From: linux-arm-kernel <linux-arm-kernel-bounces@xxxxxxxxxxxxxxxxxxx> On Behalf Of Marc Kleine-Budde
> > Sent: 14 November 2026 12:56
> > Subject: [PATCH can 4/4] can: rcar_canfd: rcar_canfd_probe(): reject devices without match data
> >
> > A device bound through driver_override need not match an entry in of_match_table. In that case
> > device_get_match_data() returns NULL, but
> > rcar_canfd_probe() dereferences the result.
> >
> > Reject devices without match data before continuing probe.
> >
> > Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
> > ---
> > drivers/net/can/rcar/rcar_canfd.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
> > index 000a6433f46d..9d463a9c1766 100644
> > --- a/drivers/net/can/rcar/rcar_canfd.c
> > +++ b/drivers/net/can/rcar/rcar_canfd.c
> > @@ -2113,6 +2113,8 @@ static int rcar_canfd_probe(struct platform_device *pdev)
> > int i;
> >
> > info = of_device_get_match_data(dev);
> > + if (!info)
> > + return -ENODEV;
>
>
> There is a patch on the fly to disable driver_override by default [1].
> In that case if we plan to use driver_override, probe will return failure.
> I may be wrong. Please correct me if Iam wrong
>
> [1] https://lore.kernel.org/all/0f7446324f6a0c8f0153d6532d92a6eeecd6a308.1790612298.git.u.kleine-koenig@xxxxxxxxxxxx/
Thanks, I wasn't aware of this series. I tested the driver_override on
the flexcan driver with latest net/main, fixed it, and applied the fix
to all affected CAN drivers.
Should I drop the driver_override related null pointer checks from this
series?
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
Attachment:
signature.asc
Description: PGP signature