* [PATCH] regmap: fix NULL deref on lookup
@ 2023-10-06 8:21 Johan Hovold
2023-10-10 16:16 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Johan Hovold @ 2023-10-06 8:21 UTC (permalink / raw)
To: Mark Brown
Cc: Greg Kroah-Hartman, Rafael J. Wysocki, linux-kernel,
Johan Hovold, stable, Marc Kleine-Budde
Not all regmaps have a name so make sure to check for that to avoid
dereferencing a NULL pointer when dev_get_regmap() is used to lookup a
named regmap.
Fixes: e84861fec32d ("regmap: dev_get_regmap_match(): fix string comparison")
Cc: stable@vger.kernel.org # 5.8
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/base/regmap/regmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 884cb51c8f67..234a84ecde8b 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1478,7 +1478,7 @@ static int dev_get_regmap_match(struct device *dev, void *res, void *data)
/* If the user didn't specify a name match any */
if (data)
- return !strcmp((*r)->name, data);
+ return (*r)->name && !strcmp((*r)->name, data);
else
return 1;
}
--
2.41.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] regmap: fix NULL deref on lookup
2023-10-06 8:21 [PATCH] regmap: fix NULL deref on lookup Johan Hovold
@ 2023-10-10 16:16 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2023-10-10 16:16 UTC (permalink / raw)
To: Johan Hovold
Cc: Greg Kroah-Hartman, Rafael J. Wysocki, linux-kernel, stable,
Marc Kleine-Budde
On Fri, 06 Oct 2023 10:21:04 +0200, Johan Hovold wrote:
> Not all regmaps have a name so make sure to check for that to avoid
> dereferencing a NULL pointer when dev_get_regmap() is used to lookup a
> named regmap.
>
>
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-next
Thanks!
[1/1] regmap: fix NULL deref on lookup
commit: c6df843348d6b71ea986266c12831cb60c2cf325
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-10-10 16:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-06 8:21 [PATCH] regmap: fix NULL deref on lookup Johan Hovold
2023-10-10 16:16 ` Mark Brown
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®