mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Lee Jones <lee@kernel.org>
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	"George G. Davis" <gdavis@mvista.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Dave Gerlach <d-gerlach@ti.com>, Keerthy <j-keerthy@ti.com>,
	linux-rtc@vger.kernel.org, Tony Lindgren <tony@atomide.com>
Subject: Re: [PATCH v2 09/10] rtc: omap: prevent NULL and dangling pointer dereferences in power-off path
Date: Thu, 3 Dec 2026 07:59:18 +0100	[thread overview]
Message-ID: <axETRpo4hOiCklvY@hovoldconsulting.com> (raw)
In-Reply-To: <f042677983a6d70047dc75552356ff68b1d964ca.1796242916.git.lee@kernel.org>

On Wed, Dec 02, 2026 at 08:22:38PM +0000, Lee Jones wrote:
> omap_rtc_power_off_program() is exported and called directly from
> am33xx_rtc_only_idle() during suspend without checking whether
> omap_rtc_power_off_rtc is NULL, causing a NULL pointer dereference if
> omap_rtc_power_off_rtc was never assigned or was cleared on unbind.
> Furthermore, omap_rtc_remove() only clears omap_rtc_power_off_rtc if
> pm_power_off still equals omap_rtc_power_off; if another driver
> overwrote pm_power_off after probe, unbinding the RTC leaves
> omap_rtc_power_off_rtc pointing to freed memory for subsequent calls to
> omap_rtc_power_off_program().
> 
> Return -ENODEV from omap_rtc_power_off_program() when
> omap_rtc_power_off_rtc is NULL, and always clear omap_rtc_power_off_rtc
> when removing the matching RTC instance.
> 
> Fixes: 5a99ae0092fe ("soc: ti: pm33xx: AM437X: Add rtc_only with ddr in self-refresh support")
> Closes: https://sashiko.dev/#/bug/linux-97b795c5-f68f-4228-948f-547a106c6775
> Cc: stable@vger.kernel.org
> Signed-off-by: Lee Jones <lee@kernel.org>
> ---
> 
> v1 => v2:
>  - Update Fixes: tag to 5a99ae0092fe ("soc: ti: pm33xx: AM437X: Add
>    rtc_only with ddr in self-refresh support") and reword the commit
>    message accordingly (Johan)
>  - Drop the unrelated refactoring in omap_rtc_power_off() (Johan)

Reviewed-by: Johan Hovold <johan@kernel.org>

  reply	other threads:[~2026-12-03  6:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 20:22 [PATCH v2 00/10] rtc: assorted bug fixes across RTC drivers Lee Jones
2026-12-02 20:22 ` [PATCH v2 01/10] rtc: rx8025: pass parent I2C device in clock_adjust_ppb sysfs callbacks Lee Jones
2026-12-02 20:22 ` [PATCH v2 02/10] rtc: mt6397: handle non-DT platform device matching in probe Lee Jones
2026-12-02 20:22 ` [PATCH v2 03/10] rtc: ma35d1: allocate RTC device before requesting interrupt Lee Jones
2026-12-02 20:22 ` [PATCH v2 04/10] rtc: mpc5121: get interrupts via platform_get_irq() Lee Jones
2026-12-02 20:22 ` [PATCH v2 05/10] rtc: m41t80: use devm helpers for square-wave clock registration Lee Jones
2026-12-02 20:22 ` [PATCH v2 06/10] rtc: nct3018y: fix clock provider use-after-free and leak on unbind Lee Jones
2026-12-02 20:22 ` [PATCH v2 07/10] rtc: stmp3xxx: unregister child watchdog platform device " Lee Jones
2026-12-02 20:22 ` [PATCH v2 08/10] rtc: ds1685: check driver data for NULL in ds1685_rtc_poweroff() Lee Jones
2026-12-02 20:22 ` [PATCH v2 09/10] rtc: omap: prevent NULL and dangling pointer dereferences in power-off path Lee Jones
2026-12-03  6:59   ` Johan Hovold [this message]
2026-12-02 20:22 ` [PATCH v2 10/10] rtc: bq32k: use u8 register buffer in trickle_charge_bypass sysfs Lee Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=axETRpo4hOiCklvY@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=d-gerlach@ti.com \
    --cc=gdavis@mvista.com \
    --cc=j-keerthy@ti.com \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®