All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yuehaibing <yuehaibing@huawei.com>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: David Miller <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	"Jiri Pirko" <jiri@mellanox.com>,
	Linux Kernel Network Developers <netdev@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] net: genetlink: Fix memleak in genl_family_rcv_msg_dumpit()
Date: Wed, 3 Jun 2020 10:20:22 +0800	[thread overview]
Message-ID: <da1d3625-f2a1-bd38-21e0-1e64139f6893@huawei.com> (raw)
In-Reply-To: <CAM_iQpXtsvewiN3bmfJqwuURN--aCkaR7N6zfYWf82KmFUZnLQ@mail.gmail.com>

On 2020/6/3 2:04, Cong Wang wrote:
> On Mon, Jun 1, 2020 at 11:47 PM YueHaibing <yuehaibing@huawei.com> wrote:
>> @@ -630,6 +625,9 @@ static int genl_family_rcv_msg_dumpit(const struct genl_family *family,
>>                 err = __netlink_dump_start(net->genl_sock, skb, nlh, &c);
>>         }
>>
>> +       genl_family_rcv_msg_attrs_free(info->family, info->attrs, true);
>> +       genl_dumpit_info_free(info);
>> +
>>         return err;
>>  }
> 
> I do not think you can just move it after __netlink_dump_start(),
> because cb->done() can be called, for example, in netlink_sock_destruct()
> too.

netlink_sock_destruct() call cb->done() while nlk->cb_running is true,

if nlk->cb_running is not set to true in __netlink_dump_start() before return,

the memleak still occurs.

> 
> 


      reply	other threads:[~2020-06-03  2:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-02  6:45 [PATCH] net: genetlink: Fix memleak in genl_family_rcv_msg_dumpit() YueHaibing
2020-06-02 18:04 ` Cong Wang
2020-06-03  2:20   ` Yuehaibing [this message]

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=da1d3625-f2a1-bd38-21e0-1e64139f6893@huawei.com \
    --to=yuehaibing@huawei.com \
    --cc=davem@davemloft.net \
    --cc=jiri@mellanox.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=xiyou.wangcong@gmail.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.