Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Qihang <q.h.hack.winter@gmail.com>
To: netdev@vger.kernel.org
Cc: Jamal Hadi Salim <jhs@mojatatu.com>,
	Jiri Pirko <jiri@resnulli.us>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	stable@vger.kernel.org
Subject: Re: [PATCH net] net/sched: cls_api: unlink indr cb on a failed bind
Date: Sun, 18 Oct 2026 11:30:15 +0000	[thread overview]
Message-ID: <1792323015.61575.10feb7db22@gmail.com> (raw)
In-Reply-To: <20261013162949.25622-1-q.h.hack.winter@gmail.com>

The [High] finding is valid, thanks.

flow_block_indr_list is protected by flow_indr_block_lock, and the err_unroll
path ran without it, so the list_del_init() there could race a concurrent
flow_indr_dev_unregister() that walks the list under that lock -- and, if the
notify half unlinks first, list_empty()/list_del_init() could touch a node
that is already off-list.

v2 keeps the unlink but does it under the lock: it adds
flow_indr_block_cb_unlink(), which takes flow_indr_block_lock and calls
list_del_init(), and tcf_block_bind()'s error path calls that instead of
touching indr.list directly.  Taking cb_lock before flow_indr_block_lock is
the order the indirect bind already uses (tcf_block_offload_bind() ->
tcf_block_offload_cmd() -> flow_indr_dev_setup_offload()), so no new lock
nesting is introduced, and the bind and driver-unregister paths are serialized
by rtnl in any case.  flow_block_cb_alloc() now initialises indr.list, so the
helper is a no-op for the direct (non-indirect) callbacks that are never on
the global list.

Rebuilt and re-run under KASAN (arm64): the unpatched kernel panics in
flow_indr_dev_unregister() with a slab-use-after-free, the v2 kernel completes
clean -- the bind still fails with -EOPNOTSUPP and the driver's
flow_indr_dev_unregister() returns 0 with no report.

pw-bot: cr


      parent reply	other threads:[~2026-10-18 11:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13 16:29 [PATCH net] net/sched: cls_api: unlink indr cb on a failed bind Qihang
2026-10-13 16:35 ` netdev-bot+sinfo
2026-10-15 19:30 ` netdev-bot+sashiko
2026-10-18 11:30 ` Qihang [this message]

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=1792323015.61575.10feb7db22@gmail.com \
    --to=q.h.hack.winter@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    /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