From: Terry Lam <vtlam@google.com>
To: John Fastabend <john.fastabend@gmail.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
Linux Netdev List <netdev@vger.kernel.org>,
Eric Dumazet <edumazet@google.com>
Subject: Re: [net PATCH v2] net: sched: lock imbalance in hhf qdisc
Date: Fri, 2 May 2014 01:26:20 -0700 [thread overview]
Message-ID: <CAHy_qTx8FegdTDcf-g5xmmt8M6+s3hPPWx4PCezeuM5AkOLBsA@mail.gmail.com> (raw)
In-Reply-To: <20140501162300.17183.83124.stgit@nitbit.x32>
Thanks a lot for the fix, John and Eric!
Regards,
Terry
On Thu, May 1, 2014 at 9:23 AM, John Fastabend <john.fastabend@gmail.com> wrote:
> hhf_change() takes the sch_tree_lock and releases it but misses the
> error cases. Fix the missed case here.
>
> To reproduce try a command like this,
>
> # tc qdisc change dev p3p2 root hhf quantum 40960 non_hh_weight 300000
>
> Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
> ---
> net/sched/sch_hhf.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/net/sched/sch_hhf.c b/net/sched/sch_hhf.c
> index edee03d..6e957c3 100644
> --- a/net/sched/sch_hhf.c
> +++ b/net/sched/sch_hhf.c
> @@ -553,11 +553,6 @@ static int hhf_change(struct Qdisc *sch, struct nlattr *opt)
> if (err < 0)
> return err;
>
> - sch_tree_lock(sch);
> -
> - if (tb[TCA_HHF_BACKLOG_LIMIT])
> - sch->limit = nla_get_u32(tb[TCA_HHF_BACKLOG_LIMIT]);
> -
> if (tb[TCA_HHF_QUANTUM])
> new_quantum = nla_get_u32(tb[TCA_HHF_QUANTUM]);
>
> @@ -567,6 +562,12 @@ static int hhf_change(struct Qdisc *sch, struct nlattr *opt)
> non_hh_quantum = (u64)new_quantum * new_hhf_non_hh_weight;
> if (non_hh_quantum > INT_MAX)
> return -EINVAL;
> +
> + sch_tree_lock(sch);
> +
> + if (tb[TCA_HHF_BACKLOG_LIMIT])
> + sch->limit = nla_get_u32(tb[TCA_HHF_BACKLOG_LIMIT]);
> +
> q->quantum = new_quantum;
> q->hhf_non_hh_weight = new_hhf_non_hh_weight;
>
>
next prev parent reply other threads:[~2014-05-02 8:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-01 16:23 [net PATCH v2] net: sched: lock imbalance in hhf qdisc John Fastabend
2014-05-01 17:12 ` Eric Dumazet
2014-05-02 8:26 ` Terry Lam [this message]
2014-05-04 23:42 ` 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=CAHy_qTx8FegdTDcf-g5xmmt8M6+s3hPPWx4PCezeuM5AkOLBsA@mail.gmail.com \
--to=vtlam@google.com \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=john.fastabend@gmail.com \
--cc=netdev@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;
as well as URLs for NNTP newsgroup(s).