Re: [PATCH 08/10] rtc: ds1685: check driver data for NULL in ds1685_rtc_poweroff()

From: Imre Kaloz

Date: Sun Nov 29 2026 - 11:09:21 EST


Hi Lee,

On Mon, Nov 23, 2026, at 20:59, Lee Jones wrote:
> ip32_poweroff() invokes ds1685_rtc_poweroff() with the static
> ip32_rtc_device platform device. If ds1685_rtc_probe() previously
> failed or the device was unbound, platform_get_drvdata() returns NULL
> even though pdev is non-NULL, causing a NULL pointer dereference at
> rtc->irq_num instead of entering the intended fallback spin loop.
>
> Verify that platform_get_drvdata() is non-NULL alongside pdev before
> dereferencing rtc.
>
> Fixes: aaaf5fbf56f1 ("rtc: add driver for DS1685 family of real time clocks")
> Closes: https://sashiko.dev/#/bug/linux-0a1838c9-65d2-4d1c-bc21-35a6a2582144
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Lee Jones <lee@xxxxxxxxxx>

Tested on an SGI O2 (RM5200). With rtc-ds1685 unbound, poweroff -f
without this patch faults in ds1685_rtc_poweroff() on address 0x1c;
with it, the "spinning forever" message is printed instead. With the
driver bound, power-off works as before.

Tested-by: Imre Kaloz <kaloz@xxxxxxxxxx>


Thanks,
Imre