netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: xiyou.wangcong@gmail.com
Cc: netdev@vger.kernel.org,
	syzbot+0a0596220218fcb603a8@syzkaller.appspotmail.com,
	syzbot+63bdb6006961d8c917c6@syzkaller.appspotmail.com,
	jhs@mojatatu.com, jiri@resnulli.us
Subject: Re: [Patch net] net_sched: fix ops->bind_class() implementations
Date: Mon, 27 Jan 2020 10:52:15 +0100 (CET)	[thread overview]
Message-ID: <20200127.105215.1264835920548133703.davem@davemloft.net> (raw)
In-Reply-To: <20200124002618.21518-1-xiyou.wangcong@gmail.com>

From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Thu, 23 Jan 2020 16:26:18 -0800

> The current implementations of ops->bind_class() are merely
> searching for classid and updating class in the struct tcf_result,
> without invoking either of cl_ops->bind_tcf() or
> cl_ops->unbind_tcf(). This breaks the design of them as qdisc's
> like cbq use them to count filters too. This is why syzbot triggered
> the warning in cbq_destroy_class().
> 
> In order to fix this, we have to call cl_ops->bind_tcf() and
> cl_ops->unbind_tcf() like the filter binding path. This patch does
> so by refactoring out two helper functions __tcf_bind_filter()
> and __tcf_unbind_filter(), which are lockless and accept a Qdisc
> pointer, then teaching each implementation to call them correctly.
> 
> Note, we merely pass the Qdisc pointer as an opaque pointer to
> each filter, they only need to pass it down to the helper
> functions without understanding it at all.
> 
> Fixes: 07d79fc7d94e ("net_sched: add reverse binding for tc class")
> Reported-and-tested-by: syzbot+0a0596220218fcb603a8@syzkaller.appspotmail.com
> Reported-and-tested-by: syzbot+63bdb6006961d8c917c6@syzkaller.appspotmail.com
> Cc: Jamal Hadi Salim <jhs@mojatatu.com>
> Cc: Jiri Pirko <jiri@resnulli.us>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>

Applied and queued up for -stable.

      reply	other threads:[~2020-01-27  9:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-24  0:26 [Patch net] net_sched: fix ops->bind_class() implementations Cong Wang
2020-01-27  9:52 ` David Miller [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=20200127.105215.1264835920548133703.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    --cc=syzbot+0a0596220218fcb603a8@syzkaller.appspotmail.com \
    --cc=syzbot+63bdb6006961d8c917c6@syzkaller.appspotmail.com \
    --cc=xiyou.wangcong@gmail.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).