From: John Fastabend <john.fastabend@gmail.com>
To: wang.bo116@zte.com.cn
Cc: davem@davemloft.net, kaber@trash.net, netdev@vger.kernel.org,
cui.yunfeng@zte.com.cn
Subject: Re: [PATCH net] net/sched: Fix use of wild pointer in mq_destroy() when qdisc_alloc fail
Date: Fri, 24 Oct 2014 10:49:46 -0700 [thread overview]
Message-ID: <544A913A.1060100@gmail.com> (raw)
In-Reply-To: <OF7A403C69.2C35464E-ON48257D7B.002E24AA-48257D7B.002F2A62@zte.com.cn>
On 10/24/2014 01:34 AM, wang.bo116@zte.com.cn wrote:
>
[...]
>
> --------------------------------------------------------------------------------
>
> This patch fix this problem, base on linux 3.18-rc-1:
>
> Signed-off-by: Wang Bo <wang.bo116@zte.com.cn>
> Tested-by: Ma Chenggong <ma.chenggong@zte.com.cn>
> diff --git a/net/sched/sch_mq.c b/net/sched/sch_mq.c
> index 42f72f1..a0c90e7 100755
> --- a/net/sched/sch_mq.c
> +++ b/net/sched/sch_mq.c
> @@ -33,6 +33,7 @@ static void mq_destroy(struct Qdisc *sch)
> for (ntx = 0; ntx < dev->num_tx_queues && priv->qdiscs[ntx]; ntx++)
> qdisc_destroy(priv->qdiscs[ntx]);
> kfree(priv->qdiscs);
> + priv->qdiscs = NULL;
> }
>
> static int mq_init(struct Qdisc *sch, struct nlattr *opt)
>
Acked-by: John Fastabend <john.r.fastabend@intel.com>
Patch looks fine, another way to fix this would be drop the
mq_destroy() call in the error path. I'm not convinced one
is any better than the other but maybe some other folks have
opinions, it seems a bit wrong to call mq_destroy twice so in
that sense it may be a bit nicer to drop the mq_destroy().
Also same bug in mqprio do you want to submit a patch for
that qdisc as well? Otherwise I can.
Thanks!
--
John Fastabend Intel Corporation
next prev parent reply other threads:[~2014-10-24 17:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-24 8:34 [PATCH net] net/sched: Fix use of wild pointer in mq_destroy() when qdisc_alloc fail wang.bo116
2014-10-24 17:49 ` John Fastabend [this message]
2014-10-24 18:13 ` Cong Wang
2014-10-24 18:58 ` Cong Wang
2014-10-24 19:14 ` Patrick McHardy
2014-10-24 20:52 ` Cong Wang
2014-10-24 21:45 ` Patrick McHardy
2014-10-24 22:17 ` Cong Wang
2014-10-25 0:33 ` Patrick McHardy
2014-10-25 0:57 ` Cong Wang
2014-10-25 1:33 ` Patrick McHardy
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=544A913A.1060100@gmail.com \
--to=john.fastabend@gmail.com \
--cc=cui.yunfeng@zte.com.cn \
--cc=davem@davemloft.net \
--cc=kaber@trash.net \
--cc=netdev@vger.kernel.org \
--cc=wang.bo116@zte.com.cn \
/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).