[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM_iQpU8rvceS7tAgv6DacHvaxJFBFDJSFhhBhWV-wqJ+A_xOA@mail.gmail.com>
Date: Mon, 6 Jan 2014 15:23:09 -0800
From: Cong Wang <xiyou.wangcong@...il.com>
To: David Miller <davem@...emloft.net>
Cc: Linux Kernel Network Developers <netdev@...r.kernel.org>,
Thomas Graf <tgraf@...g.ch>,
Jamal Hadi Salim <jhs@...atatu.com>
Subject: Re: [Patch net] cls_cgroup: fix memory leak in cls_cgroup_change()
On Fri, Jan 3, 2014 at 6:02 PM, David Miller <davem@...emloft.net> wrote:
> From: Cong Wang <xiyou.wangcong@...il.com>
> Date: Fri, 3 Jan 2014 11:13:19 -0800
>
>> Fix it by moving allocation to ->init().
>>
>> Cc: Thomas Graf <tgraf@...g.ch>
>> Cc: David S. Miller <davem@...emloft.net>
>> Cc: Jamal Hadi Salim <jhs@...atatu.com>
>> Signed-off-by: Cong Wang <xiyou.wangcong@...il.com>
>
> I don't understand how the memory leak can happen, please explain
> it in your commit message.
>
The leak happens when ->change() fails after the allocation
inside cls_cgroup_change(), its caller only does cleanup
when itself creates one. So, the callee should do cleanup
on error path by itself. But I may miss something.
Since it is not urgent at all, I will explain this in changelog
and resend it for net-next.
> Also:
>
>> {
>> + struct cls_cgroup_head *head;
>> + head = kzalloc(sizeof(*head), GFP_KERNEL);
>
> Please add an empty line between local variable declarations
> and code.
>
OK.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists