[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAM_iQpUUYR0h7HxrBYXum-3Tij9i7VNzrv5c+jbqAajQuxf6xQ@mail.gmail.com>
Date: Fri, 9 Jun 2017 14:35:32 -0700
From: Cong Wang <xiyou.wangcong@...il.com>
To: Xin Long <lucien.xin@...il.com>
Cc: Eric Dumazet <eric.dumazet@...il.com>,
Andrey Konovalov <andreyknvl@...gle.com>,
"David S. Miller" <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH net] ipv4: igmp: fix a use after free
On Fri, Jun 9, 2017 at 11:05 AM, Xin Long <lucien.xin@...il.com> wrote:
> On Sat, Jun 10, 2017 at 1:01 AM, Cong Wang <xiyou.wangcong@...il.com> wrote:
>> This is what I thought in my first response, until I realized
>> it is not pure RCU, otherwise pmc->lock should not be taken
>> in igmpv3_send_cr(). It seems the code is mixing the use
>> of spinlock and RCU.
> rcu lock is for pmc not being freed, and spinlock is for pmc's
> members' modification. is there some rule these two locks
> should be mixed?
>
This is exactly why I said we are mixing RCU and spinlock.
>
>>
>> We need RCU anyway, ip_check_mc_rcu() is the real fast
>> path where we don't take spinlock. I think we will need more
>> work.
> It seems all add_grec() callings needs spinlock, maybe add_grec
> modifies pmc's member. it's hard to drop spinlock.
>
> from ip_check_mc_rcu you mentioned about, it should be right
> to call ip_mc_clear_src after rcu grace period, like Eric's patch.
Well, more than just that, we need to use proper RCU API for
pmc->sources and you know it is a singly linked list...
I will work on this.
Powered by blists - more mailing lists