regmap: Fix bus context frees on init failure
Get series with b4
b4 am [email protected] change-id 20261129-regmap-devm-ctx-2955bb2c1077Versions newest first
- v1 Latest2 patches 2 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | regmap: Don't free the bus context when devm init failsdrivers/ | +12 | 0 replies | |
| 2/2 | regmap: mmio: Free the context if regmap init failsdrivers/ | +14 | 0 replies |
Reviews trailers per patch
None of the 2 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Peng Fan |
|---|---|
| Series | R-b |
| 1/2 | |
| 2/2 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/2] regmap: Fix bus context frees on init failure
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,
Signature · 1 line
Arun Iyengar <[email protected]>