Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp2705329pxf; Sun, 4 Apr 2021 11:06:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4V61bf34gYhoiMJcf97LwFJMCMSdhj6IPh/AV6FB0ysgqSv6Lr7LdSXDbpYLBO8rChMyK X-Received: by 2002:a17:906:c7cc:: with SMTP id dc12mr5815767ejb.423.1617559616152; Sun, 04 Apr 2021 11:06:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617559616; cv=none; d=google.com; s=arc-20160816; b=mOMAKAkPYJvReYpXNJWcs4T/u0UDNKh/DgOIAf26H4loY5dypsUB0st3TYhT+enUpa wnSy2YL4kxfZ/LNub7Q8XnLsvRpY0u890BfczstALPmlHTkEy5fTGtlP3QvfN46Pgczp rcHw1kYAzSU3C/k0xwQPh9dYaMm+xsBZOwitQ9OpjIKUe2eFVmXXMYwQa90zYrY5UaC3 /JNruYujTOIFEft4SPiaGfAkfBB0nYUa6rDkKMoyRzoqut3g60Z6vfP766fY/cHyL8zs HzxX9Kv+KVYKedY7bysZUMFw5sKVe4FWl6vUcWpQkEDMzqRfTz7TcRQRw+kjjOLXhmNR 8qYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=4OUUvirn93fdsWMpx24If9RDEHM/CZb55TYxhFkAFiI=; b=IivRU+02/NbNU2BAwCTq6ujqMULn7SMuqKDeNDMjykazrN3Op+g9J9WGkhN2whXY8B +hIU/rtxO04FIJIzvKc4mfL780A1XsFkLSGhD/p11FoEH3c9gDM2hyV+RCz781MOuxcQ PD7gkAbTdaQWj6gprQTj8QionQYkABbPkcgNuk8J0Zw/2UHZtSaWH3JsiaYW9sMZKiJz 5yuYd8lQlSfY5j4l6j0URCHcei2zak5MMps9euuBsI8MqLX/ZzBMAI73p49iQqMY4PpB Veh2Fr1Gu+C1hPOHnoTF2MC5t8b+x7EgSYTnWnTQ0XqCPTxd+BMEuqWoiE3nKfTJ8n+x Dinw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h25si11545405ejd.683.2021.04.04.11.06.33; Sun, 04 Apr 2021 11:06:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231370AbhDDSBt (ORCPT + 99 others); Sun, 4 Apr 2021 14:01:49 -0400 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:54679 "EHLO relay1-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231285AbhDDSBo (ORCPT ); Sun, 4 Apr 2021 14:01:44 -0400 X-Originating-IP: 78.45.89.65 Received: from [192.168.1.23] (ip-78-45-89-65.net.upcbroadband.cz [78.45.89.65]) (Authenticated sender: i.maximets@ovn.org) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 189EC240003; Sun, 4 Apr 2021 18:01:36 +0000 (UTC) Subject: Re: [PATCH net] openvswitch: fix send of uninitialized stack memory in ct limit reply To: Ilya Maximets , Pravin B Shelar Cc: "David S. Miller" , Jakub Kicinski , Yi-Hung Wei , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, ovs dev References: <20210404175031.3834734-1-i.maximets@ovn.org> From: Ilya Maximets Message-ID: <84e7d112-f29f-022a-8863-69f1db157c10@ovn.org> Date: Sun, 4 Apr 2021 20:01:34 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <20210404175031.3834734-1-i.maximets@ovn.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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, > + }; > > return nla_put_nohdr(reply, sizeof(zone_limit), &zone_limit); > } >