netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Thomas Graf <tgraf@suug.ch>
Cc: "David S. Miller" <davem@davemloft.net>, netdev@oss.sgi.com
Subject: Re: [PATCH] PKT_SCHED: Prevent destroying via RTM_DELTFILTER while classifying
Date: Fri, 10 Dec 2004 03:08:10 +0100	[thread overview]
Message-ID: <41B9050A.1060401@trash.net> (raw)
In-Reply-To: <20041210014322.GS1371@postel.suug.ch>

Thomas Graf wrote:

>The classify function of every cls is invoked under BH and 
>dev->queue_lock spinlock from dev_xmit. Hence to serialize destroying
>the destroy function must be called under the spinlock as well. There
>are 2 paths in which a classifier can be destroyed:
>
>1) via the qdisc destroy cb calling tcf_destroy under
>   qdisc_tree_lock from __qdisc_destroy (rcu callback)
>      
>2) via RTM_DELTFILTER in cls_api.c under no locks at all.
>
>The first path seems ok, the initial qdisc destroy attempt is called
>under the spinlock and thus serialized with the classify while
>the list unlinking takes place and dev_xmit takes care of
>the RCU callback, hence classify and all the callbacks needed
>from process context cannot be found anymore.
>
>The second path needs the spinlock to avoid destroying while
>a classification is in progress. 2.4 probably needs the same fix,
>I will cook one up if so.
>  
>
This is not correct. The classifier is unlinked in tc_ctl_tfilter
before it is destroyed, so it is not visible for classification anymore.

        if (fh == 0) {
                if (n->nlmsg_type == RTM_DELTFILTER && t->tcm_handle == 0) {
                        qdisc_lock_tree(dev);
                        *back = tp->next;
                        qdisc_unlock_tree(dev);

                        tfilter_notify(skb, n, tp, fh, RTM_DELTFILTER);
                        tcf_destroy(tp);
                        err = 0;
                        goto errout;
                }

Regards
Patrick

  reply	other threads:[~2004-12-10  2:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-10  1:43 [PATCH] PKT_SCHED: Prevent destroying via RTM_DELTFILTER while classifying Thomas Graf
2004-12-10  2:08 ` Patrick McHardy [this message]
2004-12-10 12:29   ` Thomas Graf

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=41B9050A.1060401@trash.net \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=netdev@oss.sgi.com \
    --cc=tgraf@suug.ch \
    /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).