Re: [PATCH] drm/tiny: sharp-memory: reject devices without match data
From: Uwe Kleine-König
Date: Sat Sep 26 2026 - 02:36:05 EST
Hello,
On Fri, Sep 25, 2026 at 08:36:08PM +0800, Jiale Yao wrote:
> SPI driver_override allows a device to bind to this driver without
> matching either the OF or SPI device ID table. In that case,
> spi_get_device_match_data() returns NULL.
>
> sharp_memory_probe() immediately dereferences the returned display mode
> to calculate the pitch and transmit buffer size, causing a NULL pointer
> dereference.
>
> Commit 572a00852635 ("iio: dac: ad5686: missing NULL check on match
> data") fixed the same driver_override issue in another SPI driver.
> Reject devices without match data before using the display mode.
>
> Fixes: b8f9f21716fe ("drm/tiny: Add driver for Sharp Memory LCD")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Jiale Yao <yaojiale02@xxxxxxx>
Note there is an effort to make it impossible to use driver_override in
the core and only allow a few dedicated drivers. (See
https://lore.kernel.org/lkml/20260922-driver-override-opt-out-v1-0-58c35ded3b83@xxxxxxxxxx/)
That should make your effort to implement that check in all the driver
redundant.
Best regards
Uwe
Attachment:
signature.asc
Description: PGP signature