lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM_iQpXJzqy2uQ2gq4AmPRyPjtWE6f+6duHo_0yRyoB-4imnEg@mail.gmail.com>
Date:   Mon, 23 Sep 2019 14:10:36 -0700
From:   Cong Wang <xiyou.wangcong@...il.com>
To:     Eric Dumazet <eric.dumazet@...il.com>
Cc:     Jakub Kicinski <jakub.kicinski@...ronome.com>,
        Eric Dumazet <edumazet@...gle.com>,
        "David S . Miller" <davem@...emloft.net>,
        netdev <netdev@...r.kernel.org>,
        syzbot <syzkaller@...glegroups.com>,
        Vlad Buslov <vladbu@...lanox.com>,
        Jiri Pirko <jiri@...lanox.com>
Subject: Re: [PATCH net] net: sched: fix possible crash in tcf_action_destroy()

On Mon, Sep 23, 2019 at 8:44 AM Eric Dumazet <eric.dumazet@...il.com> wrote:
>
>
>
> On 9/21/19 7:08 PM, Jakub Kicinski wrote:
> > 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@...glegroups.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?
> >
>
> I do not have any preference really, this is slow path and was trying to
> fix a crash.
>
> tcf_action_destroy() makes me nervous, since it seems to be able to break its loop
> in case __tcf_idr_release() returns an error. This means that some actions will
> never be release.

Good point. Seems we can just continue the loop even when
-EPERM is returned, there is in fact no harm to leave those still
bound to filters there until the filers release them. Not sure if we
should still propagate -EPERM to users in this partially failure
case.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ