From: Patrick McHardy <kaber@trash.net>
To: Cong Wang <cwang@twopensource.com>
Cc: John Fastabend <john.fastabend@gmail.com>,
Wang Bo <wang.bo116@zte.com.cn>,
David Miller <davem@davemloft.net>,
netdev <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: Sat, 25 Oct 2014 02:33:52 +0100 [thread overview]
Message-ID: <20141025013352.GE11289@acer.localdomain> (raw)
In-Reply-To: <CAHA+R7MW-kP0uO2+00+pbx1y=LQynLWy9diznccY69+8nZ5mwQ@mail.gmail.com>
On Fri, Oct 24, 2014 at 05:57:59PM -0700, Cong Wang wrote:
> On Fri, Oct 24, 2014 at 5:33 PM, Patrick McHardy <kaber@trash.net> wrote:
> >
> > Its about having a sane API.
>
> I don't see why calling ->destroy() on failure is not sane in qdisc case.
> I never want to argue general case.
Because it makes things more complicated. You need to keep track of what
was actually initialized since you can't assume a consistent state in
->destroy() anymore. If ->init() fails, it knows where it failed,
->destroy() can't know that.
Look at htb_destroy() for an example. It starts with
cancel_work_sync(&q->work);
Was that actually initialized and can be cancled? You don't know.
Next comes
qdisc_watchdog_cancel(&q->watchdog);
Same here, if the error happened before it was initialized, crash.
These are just the first two lines. You get the problem.
prev parent reply other threads:[~2014-10-25 1:33 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
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 [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=20141025013352.GE11289@acer.localdomain \
--to=kaber@trash.net \
--cc=cui.yunfeng@zte.com.cn \
--cc=cwang@twopensource.com \
--cc=davem@davemloft.net \
--cc=john.fastabend@gmail.com \
--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).