netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cong Wang <xiyou.wangcong@gmail.com>
To: dmitrolin@mellanox.com
Cc: Linux Kernel Network Developers <netdev@vger.kernel.org>,
	David Miller <davem@davemloft.net>, Jiri Pirko <jiri@resnulli.us>,
	Jamal Hadi Salim <jhs@mojatatu.com>,
	Vlad Buslov <vladbu@mellanox.com>
Subject: Re: [PATCH] net: sched: use temporary variable for actions indexes
Date: Thu, 1 Aug 2019 16:41:41 -0700	[thread overview]
Message-ID: <CAM_iQpVb_BLCna0Thi+84sHS-Wp3T0AGh6Wb9j6k8DefSEDGfA@mail.gmail.com> (raw)
In-Reply-To: <1564664571-31508-1-git-send-email-dmitrolin@mellanox.com>

On Thu, Aug 1, 2019 at 6:03 AM <dmitrolin@mellanox.com> wrote:
>
> From: Dmytro Linkin <dmitrolin@mellanox.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@mellanox.com>
> Signed-off-by: Vlad Buslov <vladbu@mellanox.com>


Acked-by: Cong Wang <xiyou.wangcong@gmail.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.

  parent reply	other threads:[~2019-08-01 23:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-01 13:02 [PATCH] net: sched: use temporary variable for actions indexes dmitrolin
2019-08-01 13:39 ` Dmytro Linkin
2019-08-01 23:41 ` Cong Wang [this message]
2019-08-05 18:00 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAM_iQpVb_BLCna0Thi+84sHS-Wp3T0AGh6Wb9j6k8DefSEDGfA@mail.gmail.com \
    --to=xiyou.wangcong@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dmitrolin@mellanox.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    --cc=vladbu@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).