The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Arun Iyengar via B4 Relay <devnull+aiyengar1990.gmail.com@kernel.org>
To: Mark Brown <broonie@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 "Rafael J. Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>,
	 Johan Hovold <johan@kernel.org>,
	 Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>,
	 linux-kernel@vger.kernel.org, driver-core@lists.linux.dev,
	 Guenter Roeck <linux@roeck-us.net>,
	linux-hwmon@vger.kernel.org,  Xu Yilun <yilun.xu@intel.com>,
	Arun Iyengar <aiyengar1990@gmail.com>
Subject: [PATCH 0/2] regmap: Fix bus context frees on init failure
Date: Mon, 30 Nov 2026 20:21:20 +0000	[thread overview]
Message-ID: <20261130-regmap-devm-ctx-v1-0-cfabbeaadee8@gmail.com> (raw)

Since b1ef855c6260, a failing __devm_regmap_init() can free the bus
context, so spi-avmm and sch56xx free it twice. Patch 1 restores the
old behaviour. Patch 2 fixes the mmio context leak on init failure.

Tested with failslab on an Orange Pi 5 (devm mmio regmap): kmemleak
finds the mmio leak, and with patch 2 alone KASAN reports the double
free. With both patches, no reports. spi-avmm and sch56xx were not run.

Developed with Claude (Anthropic), which wrote the code and the commit
messages. I reviewed every change.

---
Arun Iyengar (2):
      regmap: Don't free the bus context when devm init fails
      regmap: mmio: Free the context if regmap init fails

 drivers/base/regmap/regmap-mmio.c | 18 ++++++++++++++----
 drivers/base/regmap/regmap.c      | 20 ++++++++++++--------
 2 files changed, 26 insertions(+), 12 deletions(-)
---
base-commit: 222b61e9c570dac6c7a786d039e4c226624b426d
change-id: 20261129-regmap-devm-ctx-2955bb2c1077

Best regards,
--  
Arun Iyengar <aiyengar1990@gmail.com>



             reply	other threads:[~2026-11-30 20:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 20:21 Arun Iyengar via B4 Relay [this message]
2026-11-30 20:21 ` [PATCH 1/2] regmap: Don't free the bus context when devm init fails Arun Iyengar via B4 Relay
2026-11-30 20:21 ` [PATCH 2/2] regmap: mmio: Free the context if regmap " Arun Iyengar via B4 Relay

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=20261130-regmap-devm-ctx-v1-0-cfabbeaadee8@gmail.com \
    --to=devnull+aiyengar1990.gmail.com@kernel.org \
    --cc=aiyengar1990@gmail.com \
    --cc=broonie@kernel.org \
    --cc=dakr@kernel.org \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=johan@kernel.org \
    --cc=krzysztof.kozlowski@oss.qualcomm.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=rafael@kernel.org \
    --cc=yilun.xu@intel.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