[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM_iQpUx_Q2yDhkiw0uFrmFoPociN9zOC4iyKAm8YNEJHdNBbA@mail.gmail.com>
Date: Mon, 15 Sep 2014 15:46:47 -0700
From: Cong Wang <xiyou.wangcong@...il.com>
To: John Fastabend <john.r.fastabend@...el.com>
Cc: Linux Kernel Network Developers <netdev@...r.kernel.org>,
john fastabend <john.fastabend@...il.com>,
"David S. Miller" <davem@...emloft.net>
Subject: Re: [Patch net-next 2/5] net_sched: fix memory leak in cls_tcindex
On Mon, Sep 15, 2014 at 3:15 PM, Cong Wang <xiyou.wangcong@...il.com> wrote:
> On Mon, Sep 15, 2014 at 2:41 PM, John Fastabend
> <john.r.fastabend@...el.com> wrote:
>> Actually can we just get rid of the balloc here altogether and
>> remove the checks in errout_alloc so that cp->perfect and cp->h
>> are freed unconditionally? They should be NULL if they are not
>> being used because of the kzalloc.
>>
>
> Hmm, but for cp->h which you don't duplicate if we free it we
> free p->h too, which seems not expected. I think we probably
> need to cp->h = kmemdup(p->h) as well.
I can see why you didn't use kmemdup() there, because p->h
is accessible for readers since we now use RCU read lock.
I think that means we probably have to duplicate the whole
hash table including the chained elements. But it deserves
another patch, to fix this memory leak I think we should just keep
the balloc logic.
I will just fix the missing err = -ENOMEM.
Thanks.
--
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