From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: Cong Wang <xiyou.wangcong@gmail.com>,
Eric Dumazet <eric.dumazet@gmail.com>
Cc: Eric Dumazet <edumazet@google.com>,
"David S . Miller" <davem@davemloft.net>,
netdev <netdev@vger.kernel.org>,
syzbot <syzkaller@googlegroups.com>,
Vlad Buslov <vladbu@mellanox.com>, Jiri Pirko <jiri@mellanox.com>
Subject: Re: [PATCH net] net: sched: fix possible crash in tcf_action_destroy()
Date: Sat, 21 Sep 2019 19:08:00 -0700 [thread overview]
Message-ID: <20190921190800.3f19fe23@cakuba.netronome.com> (raw)
In-Reply-To: <CAM_iQpVyJDeScQDL6vHNAN9gu5a3c0forQ2Ko7eQihawRO_Sdw@mail.gmail.com>
On Wed, 18 Sep 2019 14:37:21 -0700, Cong Wang wrote:
> On Wed, Sep 18, 2019 at 12:57 PM 'Eric Dumazet' via syzkaller
> <syzkaller@googlegroups.com> wrote:
> >
> > If the allocation done in tcf_exts_init() failed,
> > we end up with a NULL pointer in exts->actions.
> ...
> > diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
> > index efd3cfb80a2ad775dc8ab3c4900bd73d52c7aaad..9aef93300f1c11791acbb9262dfe77996872eafe 100644
> > --- a/net/sched/cls_api.c
> > +++ b/net/sched/cls_api.c
> > @@ -3027,8 +3027,10 @@ static int tc_dump_chain(struct sk_buff *skb, struct netlink_callback *cb)
> > void tcf_exts_destroy(struct tcf_exts *exts)
> > {
> > #ifdef CONFIG_NET_CLS_ACT
> > - tcf_action_destroy(exts->actions, TCA_ACT_UNBIND);
> > - kfree(exts->actions);
> > + if (exts->actions) {
>
> I think it is _slightly_ better to check exts->nr_actions!=0 here,
> as it would help exts->actions!=NULL&& exts->nr_actions==0
> cases too.
>
> What do you think?
Alternatively, since tcf_exts_destroy() now takes NULL, and so
obviously does kfree() - perhaps tcf_action_destroy() should
return early if actions are NULL?
next prev parent reply other threads:[~2019-09-22 2:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-18 19:57 [PATCH net] net: sched: fix possible crash in tcf_action_destroy() Eric Dumazet
2019-09-18 21:37 ` Cong Wang
2019-09-22 2:08 ` Jakub Kicinski [this message]
2019-09-23 15:44 ` Eric Dumazet
2019-09-23 21:10 ` Cong Wang
2019-09-24 14:36 ` 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=20190921190800.3f19fe23@cakuba.netronome.com \
--to=jakub.kicinski@netronome.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=jiri@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=syzkaller@googlegroups.com \
--cc=vladbu@mellanox.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