On 2020/6/3 2:04, Cong Wang wrote: > On Mon, Jun 1, 2020 at 11:47 PM YueHaibing <yuehaib...@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. > >