[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221103192308.581a9124@kernel.org>
Date: Thu, 3 Nov 2022 19:23:08 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Hawkins Jiawei <yin31149@...il.com>
Cc: 18801353760@....com, davem@...emloft.net, edumazet@...gle.com,
jhs@...atatu.com, jiri@...nulli.us, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, pabeni@...hat.com,
syzbot+232ebdbd36706c965ebf@...kaller.appspotmail.com,
syzkaller-bugs@...glegroups.com, xiyou.wangcong@...il.com
Subject: Re: [PATCH] net: sched: fix memory leak in tcindex_set_parms
On Fri, 4 Nov 2022 00:07:00 +0800 Hawkins Jiawei wrote:
> > Can't you localize all the changes to this if block?
> >
> > Maybe add a function called tcindex_filter_result_reinit()
> > which will act more appropriately?
>
> I think we shouldn't put the tcf_exts_destroy(&old_e)
> into this if block, or other RCU readers may derefer the
> freed memory (Please correct me If I am wrong).
>
> So I put the tcf_exts_destroy(&old_e) near the tcindex
> destroy work, after the RCU updateing.
I'm not sure what this code is trying to do, to be honest.
Your concern that there may be a concurrent reader is valid,
but then again tcindex_filter_result_init() just wipes the
entire structure with a memset() so concurrent readers are
already likely broken?
Maybe tcindex_filter_result_init() dates back to times when
exts were a list (see commit 22dc13c837c) and calling
tcf_exts_init() wasn't that different than cleaning it up?
In other words this code is trying to destroy old_r, not
reinitialize it?
> >
> > > err = tcindex_filter_result_init(old_r, cp, net);
Powered by blists - more mailing lists