linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
To: Ilya Maximets <i.maximets@ovn.org>
Cc: Pravin B Shelar <pshelar@ovn.org>, ovs dev <dev@openvswitch.org>,
	Linux Kernel Network Developers <netdev@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Jakub Kicinski <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [ovs-dev] [PATCH net] openvswitch: fix send of uninitialized stack memory in ct limit reply
Date: Mon, 5 Apr 2021 11:09:25 +0800	[thread overview]
Message-ID: <CAMDZJNXvqMaTxwF2M79ohos0VYpGvjKjMokBv4wrEgej=bdJrA@mail.gmail.com> (raw)
In-Reply-To: <84e7d112-f29f-022a-8863-69f1db157c10@ovn.org>

On Mon, Apr 5, 2021 at 2:01 AM Ilya Maximets <i.maximets@ovn.org> wrote:
>
> CC: ovs-dev
>
> On 4/4/21 7:50 PM, Ilya Maximets wrote:
> > 'struct ovs_zone_limit' has more members than initialized in
> > ovs_ct_limit_get_default_limit().  The rest of the memory is a random
> > kernel stack content that ends up being sent to userspace.
> >
> > Fix that by using designated initializer that will clear all
> > non-specified fields.
> >
> > Fixes: 11efd5cb04a1 ("openvswitch: Support conntrack zone limit")
> > Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
> > ---
> >  net/openvswitch/conntrack.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c
> > index c29b0ef1fc27..cadb6a29b285 100644
> > --- a/net/openvswitch/conntrack.c
> > +++ b/net/openvswitch/conntrack.c
> > @@ -2032,10 +2032,10 @@ static int ovs_ct_limit_del_zone_limit(struct nlattr *nla_zone_limit,
> >  static int ovs_ct_limit_get_default_limit(struct ovs_ct_limit_info *info,
> >                                         struct sk_buff *reply)
> >  {
> > -     struct ovs_zone_limit zone_limit;
> > -
> > -     zone_limit.zone_id = OVS_ZONE_LIMIT_DEFAULT_ZONE;
> > -     zone_limit.limit = info->default_limit;
> > +     struct ovs_zone_limit zone_limit = {
> > +             .zone_id = OVS_ZONE_LIMIT_DEFAULT_ZONE,
> > +             .limit   = info->default_limit,
> > +     };
I review the code, userspace don't use the count of ovs_zone_lime
struct, but this patch looks to to me.
Thanks Ilya.
Acked-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> >       return nla_put_nohdr(reply, sizeof(zone_limit), &zone_limit);
> >  }
> >
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev



-- 
Best regards, Tonghao

  reply	other threads:[~2021-04-05  3:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-04 17:50 [PATCH net] openvswitch: fix send of uninitialized stack memory in ct limit reply Ilya Maximets
2021-04-04 18:01 ` Ilya Maximets
2021-04-05  3:09   ` Tonghao Zhang [this message]
2021-04-05 22:10 ` patchwork-bot+netdevbpf

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='CAMDZJNXvqMaTxwF2M79ohos0VYpGvjKjMokBv4wrEgej=bdJrA@mail.gmail.com' \
    --to=xiangxia.m.yue@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dev@openvswitch.org \
    --cc=i.maximets@ovn.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pshelar@ovn.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).