From: Mark Brown <broonie@kernel.org>
To: Fabio Estevam <festevam@gmail.com>
Cc: matthias.schiffer@ew.tq-group.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] regmap: debugfs: Free the previous allocated debugfs_name buffer
Date: Thu, 6 Jan 2022 17:31:45 +0000 [thread overview]
Message-ID: <YdcngYVZwC2s+Pin@sirena.org.uk> (raw)
In-Reply-To: <20220106171537.3091643-1-festevam@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1282 bytes --]
On Thu, Jan 06, 2022 at 02:15:37PM -0300, Fabio Estevam wrote:
> debugfs: Directory 'dummy-iomuxc-gpr@20e0000' with parent 'regmap' already present!
>
> By inspecting the duplicate directory name:
>
> [ 0.274418] platform panel: Fixing up cyclic dependency with ldb
> [ 0.276896] ************ 1: devname is dummy
> [ 0.276926] ************ 2: name is iomuxc-gpr@20e0000
It's quite hard to read these kernel logs and tie them into anything -
they're fairly verbose and weirdly formatted with all the *********s.
> +++ b/drivers/base/regmap/regmap-debugfs.c
> @@ -589,6 +589,7 @@ void regmap_debugfs_init(struct regmap *map)
> return;
> }
> name = map->debugfs_name;
> + kfree(map->debugfs_name);
> } else {
> name = devname;
> }
> @@ -600,6 +601,7 @@ void regmap_debugfs_init(struct regmap *map)
> if (!map->debugfs_name)
> return;
> name = map->debugfs_name;
> + kfree(map->debugfs_name);
This is fairly clearly introducing a use after free bug - we've taken a
copy of map->debugfs_name in name then immediately free map->debugfs_name
so any use of name will be referencing freed memory. If this works it
will be because something went and zeroed the memory, it's just as
likely to cause us to crash.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2022-01-06 17:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-06 17:15 [PATCH] regmap: debugfs: Free the previous allocated debugfs_name buffer Fabio Estevam
2022-01-06 17:31 ` Mark Brown [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-01-09 7:51 kernel test robot
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=YdcngYVZwC2s+Pin@sirena.org.uk \
--to=broonie@kernel.org \
--cc=festevam@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matthias.schiffer@ew.tq-group.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.