Re: [PATCH] net: genetlink: Fix memleak in genl_family_rcv_msg_dumpit()

From: Cong Wang
Date: Tue Jun 02 2020 - 14:05:09 EST


On Mon, Jun 1, 2020 at 11:47 PM YueHaibing <yuehaibing@xxxxxxxxxx> 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.