[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM_iQpVb_BLCna0Thi+84sHS-Wp3T0AGh6Wb9j6k8DefSEDGfA@mail.gmail.com>
Date: Thu, 1 Aug 2019 16:41:41 -0700
From: Cong Wang <xiyou.wangcong@...il.com>
To: dmitrolin@...lanox.com
Cc: Linux Kernel Network Developers <netdev@...r.kernel.org>,
David Miller <davem@...emloft.net>,
Jiri Pirko <jiri@...nulli.us>,
Jamal Hadi Salim <jhs@...atatu.com>,
Vlad Buslov <vladbu@...lanox.com>
Subject: Re: [PATCH] net: sched: use temporary variable for actions indexes
On Thu, Aug 1, 2019 at 6:03 AM <dmitrolin@...lanox.com> wrote:
>
> From: Dmytro Linkin <dmitrolin@...lanox.com>
>
> Currently init call of all actions (except ipt) init their 'parm'
> structure as a direct pointer to nla data in skb. This leads to race
> condition when some of the filter actions were initialized successfully
> (and were assigned with idr action index that was written directly
> into nla data), but then were deleted and retried (due to following
> action module missing or classifier-initiated retry), in which case
> action init code tries to insert action to idr with index that was
> assigned on previous iteration. During retry the index can be reused
> by another action that was inserted concurrently, which causes
> unintended action sharing between filters.
> To fix described race condition, save action idr index to temporary
> stack-allocated variable instead on nla data.
>
> Fixes: 0190c1d452a9 ("net: sched: atomically check-allocate action")
> Signed-off-by: Dmytro Linkin <dmitrolin@...lanox.com>
> Signed-off-by: Vlad Buslov <vladbu@...lanox.com>
Acked-by: Cong Wang <xiyou.wangcong@...il.com>
This is a sad side-effect we have to deal with for this retry logic,
we have to restore all global status in each retry loop. :-(
Thanks.
Powered by blists - more mailing lists