mbox series

[v4,0/2] mmc: sdio: fixes some leaks

Message ID 20221110025530.4106568-1-yangyingliang@huawei.com (mailing list archive)
Headers show
Series mmc: sdio: fixes some leaks | expand

Message

Yang Yingliang Nov. 10, 2022, 2:55 a.m. UTC
This patchset fix a refcount leak and two memory leaks about
SDIO function.

v3 -> v4:
  Drop patch1, keep calling put_device() to free memory,
  set 'func->card' to NULL to avoid redundant put.

v2 -> v3:
  Change to call of_node_put() in remove() function to
  fix node refcount leak.

v1 -> v2:
  Fix compile error in patch #2.

Yang Yingliang (2):
  mmc: sdio: fix of node refcount leak in sdio_add_func()
  mmc: sdio: fix possible memory leak in some error path

 drivers/mmc/core/sdio.c     | 1 +
 drivers/mmc/core/sdio_bus.c | 6 +++---
 drivers/mmc/core/sdio_cis.c | 3 ++-
 3 files changed, 6 insertions(+), 4 deletions(-)

Comments

Yang Yingliang Nov. 18, 2022, 7:53 a.m. UTC | #1
Hi,

On 2022/11/10 10:55, Yang Yingliang wrote:
> This patchset fix a refcount leak and two memory leaks about
> SDIO function.
>
> v3 -> v4:
>    Drop patch1, keep calling put_device() to free memory,
>    set 'func->card' to NULL to avoid redundant put.
>
> v2 -> v3:
>    Change to call of_node_put() in remove() function to
>    fix node refcount leak.
>
> v1 -> v2:
>    Fix compile error in patch #2.
>
> Yang Yingliang (2):
>    mmc: sdio: fix of node refcount leak in sdio_add_func()
>    mmc: sdio: fix possible memory leak in some error path
>
>   drivers/mmc/core/sdio.c     | 1 +
>   drivers/mmc/core/sdio_bus.c | 6 +++---
>   drivers/mmc/core/sdio_cis.c | 3 ++-
>   3 files changed, 6 insertions(+), 4 deletions(-)
Is this look good to you, or any suggestions?

Thanks,
Yang
Ulf Hansson Nov. 18, 2022, 8:10 a.m. UTC | #2
On Fri, 18 Nov 2022 at 08:54, Yang Yingliang <yangyingliang@huawei.com> wrote:
>
> Hi,
>
> On 2022/11/10 10:55, Yang Yingliang wrote:
> > This patchset fix a refcount leak and two memory leaks about
> > SDIO function.
> >
> > v3 -> v4:
> >    Drop patch1, keep calling put_device() to free memory,
> >    set 'func->card' to NULL to avoid redundant put.
> >
> > v2 -> v3:
> >    Change to call of_node_put() in remove() function to
> >    fix node refcount leak.
> >
> > v1 -> v2:
> >    Fix compile error in patch #2.
> >
> > Yang Yingliang (2):
> >    mmc: sdio: fix of node refcount leak in sdio_add_func()
> >    mmc: sdio: fix possible memory leak in some error path
> >
> >   drivers/mmc/core/sdio.c     | 1 +
> >   drivers/mmc/core/sdio_bus.c | 6 +++---
> >   drivers/mmc/core/sdio_cis.c | 3 ++-
> >   3 files changed, 6 insertions(+), 4 deletions(-)
> Is this look good to you, or any suggestions?

I need some more time to review them, so I will get back to this early
next week.

Kind regards
Uffe
Ulf Hansson Nov. 22, 2022, 4:29 p.m. UTC | #3
On Fri, 18 Nov 2022 at 09:10, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
> On Fri, 18 Nov 2022 at 08:54, Yang Yingliang <yangyingliang@huawei.com> wrote:
> >
> > Hi,
> >
> > On 2022/11/10 10:55, Yang Yingliang wrote:
> > > This patchset fix a refcount leak and two memory leaks about
> > > SDIO function.
> > >
> > > v3 -> v4:
> > >    Drop patch1, keep calling put_device() to free memory,
> > >    set 'func->card' to NULL to avoid redundant put.
> > >
> > > v2 -> v3:
> > >    Change to call of_node_put() in remove() function to
> > >    fix node refcount leak.
> > >
> > > v1 -> v2:
> > >    Fix compile error in patch #2.
> > >
> > > Yang Yingliang (2):
> > >    mmc: sdio: fix of node refcount leak in sdio_add_func()
> > >    mmc: sdio: fix possible memory leak in some error path
> > >
> > >   drivers/mmc/core/sdio.c     | 1 +
> > >   drivers/mmc/core/sdio_bus.c | 6 +++---
> > >   drivers/mmc/core/sdio_cis.c | 3 ++-
> > >   3 files changed, 6 insertions(+), 4 deletions(-)
> > Is this look good to you, or any suggestions?
>
> I need some more time to review them, so I will get back to this early
> next week.

I have re-started to look into these patches, so I will provide you
with some comments very soon.

Although, may I ask how you have tested these changes? Or are the
changes done from a pure code inspection point of view?

Kind regards
Uffe
Yang Yingliang Nov. 23, 2022, 2:34 a.m. UTC | #4
On 2022/11/23 0:29, Ulf Hansson wrote:
> On Fri, 18 Nov 2022 at 09:10, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>> On Fri, 18 Nov 2022 at 08:54, Yang Yingliang <yangyingliang@huawei.com> wrote:
>>> Hi,
>>>
>>> On 2022/11/10 10:55, Yang Yingliang wrote:
>>>> This patchset fix a refcount leak and two memory leaks about
>>>> SDIO function.
>>>>
>>>> v3 -> v4:
>>>>     Drop patch1, keep calling put_device() to free memory,
>>>>     set 'func->card' to NULL to avoid redundant put.
>>>>
>>>> v2 -> v3:
>>>>     Change to call of_node_put() in remove() function to
>>>>     fix node refcount leak.
>>>>
>>>> v1 -> v2:
>>>>     Fix compile error in patch #2.
>>>>
>>>> Yang Yingliang (2):
>>>>     mmc: sdio: fix of node refcount leak in sdio_add_func()
>>>>     mmc: sdio: fix possible memory leak in some error path
>>>>
>>>>    drivers/mmc/core/sdio.c     | 1 +
>>>>    drivers/mmc/core/sdio_bus.c | 6 +++---
>>>>    drivers/mmc/core/sdio_cis.c | 3 ++-
>>>>    3 files changed, 6 insertions(+), 4 deletions(-)
>>> Is this look good to you, or any suggestions?
>> I need some more time to review them, so I will get back to this early
>> next week.
> I have re-started to look into these patches, so I will provide you
> with some comments very soon.
>
> Although, may I ask how you have tested these changes? Or are the
> changes done from a pure code inspection point of view?
Compiled test only.

Thanks,
Yang
>
> Kind regards
> Uffe
> .