Re: [PATCH] regulator: fix memory leak on error path of regulator_register()

From: Mark Brown
Date: Fri Jul 24 2020 - 10:37:40 EST


On Fri, 24 Jul 2020 03:50:13 +0300, Vladimir Zapolskiy wrote:
> The change corrects registration and deregistration on error path
> of a regulator, the problem was manifested by a reported memory
> leak on deferred probe:
>
> as3722-regulator as3722-regulator: regulator 13 register failed -517
>
> # cat /sys/kernel/debug/kmemleak
> unreferenced object 0xecc43740 (size 64):
> comm "swapper/0", pid 1, jiffies 4294937640 (age 712.880s)
> hex dump (first 32 bytes):
> 72 65 67 75 6c 61 74 6f 72 2e 32 34 00 5a 5a 5a regulator.24.ZZZ
> 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a ZZZZZZZZZZZZZZZZ
> backtrace:
> [<0c4c3d1c>] __kmalloc_track_caller+0x15c/0x2c0
> [<40c0ad48>] kvasprintf+0x64/0xd4
> [<109abd29>] kvasprintf_const+0x70/0x84
> [<c4215946>] kobject_set_name_vargs+0x34/0xa8
> [<62282ea2>] dev_set_name+0x40/0x64
> [<a39b6757>] regulator_register+0x3a4/0x1344
> [<16a9543f>] devm_regulator_register+0x4c/0x84
> [<51a4c6a1>] as3722_regulator_probe+0x294/0x754
> ...
>
> [...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/1] regulator: fix memory leak on error path of regulator_register()
commit: 9177514ce34902b3adb2abd490b6ad05d1cfcb43

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