Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1184703

Re: [PATCH] regulator: core: Fix memory leak in regulator_resolve_supply()

From Mark Brown <broonie@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH] regulator: core: Fix memory leak in regulator_resolve_supply()
Date 2015-07-15 13:30 +0200
Message-ID <pMt2W-62p-15@gated-at.bofh.it> (permalink)
References <pM9nA-3gw-15@gated-at.bofh.it> <pMq54-1Kj-13@gated-at.bofh.it> <pMqop-26J-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Wed, Jul 15, 2015 at 10:38:38AM +0200, Javier Martinez Canillas wrote:
> On 07/15/2015 10:01 AM, Krzysztof Kozlowski wrote:

> > The _regulator_put() reverts more work than create_regulator() did,
> > e.g.: module_put and rdev->open_count--. Maybe you need a
> > destroy_regulator() function?

> Yes, it reverts more work than create_regulator() but the intention is to
> revert what set_supply() did. If you look at the set_supply() function,
> it does supply_rdev->open_count++.

> I did indeed missed the module_put() but now looking at the code again, I

Me too, I've dropped the patch.  At first glance everything looked safe
for multiple calls.

> wonder if the problem is not that set_supply() is missing a try_module_get()
> to be consistent with what the _regulator_get() function does.

The problem is more that it's a separate implementation and not just
using _regulator_get() I think.  A separate, rarely used, path is likely
to have this sort of issue.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] regulator: core: Fix memory leak in regulator_resolve_supply() Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2015-07-15 10:20 +0200
  Re: [PATCH] regulator: core: Fix memory leak in  regulator_resolve_supply() Javier Martinez Canillas <javier@osg.samsung.com> - 2015-07-15 10:40 +0200
    Re: [PATCH] regulator: core: Fix memory leak in  regulator_resolve_supply() Mark Brown <broonie@kernel.org> - 2015-07-15 13:30 +0200
      Re: [PATCH] regulator: core: Fix memory leak in  regulator_resolve_supply() Javier Martinez Canillas <javier@osg.samsung.com> - 2015-07-15 14:50 +0200

csiph-web