Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: lee@kernel.org, Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Wolfgang Grandegger <wg@grandegger.com>,
	lm-sensors@lm-sensors.org,
	Sergei Poselenov <sposelenov@emcraft.com>,
	Dmitry Rakhchev <rda@emcraft.com>,
	linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: [PATCH 01/10] rtc: rx8025: pass parent I2C device in clock_adjust_ppb sysfs callbacks
Date: Mon, 23 Nov 2026 19:59:12 +0000	[thread overview]
Message-ID: <20261123200012.502284-2-lee@kernel.org> (raw)
In-Reply-To: <20261123200012.502284-1-lee@kernel.org>

Since rx8025_attr_group was converted to rtc_add_group(), the device
pointer passed to rx8025_sysfs_show_clock_adjust() and
rx8025_sysfs_store_clock_adjust() is the RTC class device (&rtc->dev)
rather than the parent I2C client device.  Passing dev directly to
rx8025_read_offset() and rx8025_set_offset() invokes to_i2c_client() on
the RTC class device, causing type confusion and an invalid pointer
dereference during SMBus register access.

Pass dev->parent to rx8025_read_offset() and rx8025_set_offset() so
they operate on the underlying I2C client device.

Fixes: 3d35840dfb75 ("rtc: rx8025: use rtc_add_group")
Closes: https://sashiko.dev/#/bug/linux-39839b9a-7a00-4bdc-8d5a-b28de75dda80
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
 drivers/rtc/rtc-rx8025.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-rx8025.c b/drivers/rtc/rtc-rx8025.c
index 1ccec7b5ae42..ab3a30982863 100644
--- a/drivers/rtc/rtc-rx8025.c
+++ b/drivers/rtc/rtc-rx8025.c
@@ -482,7 +482,7 @@ static ssize_t rx8025_sysfs_show_clock_adjust(struct device *dev,
 	int err;
 
 	dev_warn_once(dev, "clock_adjust_ppb is deprecated, use offset\n");
-	err = rx8025_read_offset(dev, &adj);
+	err = rx8025_read_offset(dev->parent, &adj);
 	if (err)
 		return err;
 
@@ -500,7 +500,7 @@ static ssize_t rx8025_sysfs_store_clock_adjust(struct device *dev,
 	if (kstrtol(buf, 10, &adj) != 0)
 		return -EINVAL;
 
-	err = rx8025_set_offset(dev, -adj);
+	err = rx8025_set_offset(dev->parent, -adj);
 
 	return err ? err : count;
 }
-- 
2.56.1.750.gf70dc682cf-goog


       reply	other threads:[~2026-11-23 20:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20261123200012.502284-1-lee@kernel.org>
2026-11-23 19:59 ` Lee Jones [this message]
2026-11-23 19:59 ` [PATCH 02/10] rtc: mt6397: handle non-DT platform device matching in probe Lee Jones
2026-11-23 19:59 ` [PATCH 03/10] rtc: ma35d1: allocate RTC device before requesting interrupt Lee Jones
2026-11-23 19:59 ` [PATCH 04/10] rtc: mpc5121: get interrupts via platform_get_irq() Lee Jones
2026-11-23 19:59 ` [PATCH 05/10] rtc: m41t80: use devm helpers for square-wave clock registration Lee Jones
2026-11-23 19:59 ` [PATCH 06/10] rtc: nct3018y: fix clock provider use-after-free and leak on unbind Lee Jones
2026-11-23 19:59 ` [PATCH 07/10] rtc: stmp3xxx: unregister child watchdog platform device " Lee Jones
2026-11-23 19:59 ` [PATCH 08/10] rtc: ds1685: check driver data for NULL in ds1685_rtc_poweroff() Lee Jones
2026-11-23 19:59 ` [PATCH 09/10] rtc: omap: prevent NULL and dangling pointer dereferences in power-off path Lee Jones
2026-11-23 19:59 ` [PATCH 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=20261123200012.502284-2-lee@kernel.org \
    --to=lee@kernel.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=lm-sensors@lm-sensors.org \
    --cc=rda@emcraft.com \
    --cc=sposelenov@emcraft.com \
    --cc=stable@vger.kernel.org \
    --cc=wg@grandegger.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