Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp2700343pxf; Sun, 4 Apr 2021 10:54:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPFKrrBmvbzdW2Ildjunt1Yt0C93+ZrA0MN4BIsTon9AMTRg0tcqvOmRUqNcyQq40djD8G X-Received: by 2002:a05:6402:1517:: with SMTP id f23mr27857282edw.272.1617558887349; Sun, 04 Apr 2021 10:54:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617558887; cv=none; d=google.com; s=arc-20160816; b=x40e4/NV4wObpzVEnU7utyqSVwAqArB51q8kRfVtNwuVEjHwv1wQNLvF+4bIjh0TB6 W2tO42BsuY4Jegm+YrEAIPwgIP/U9iv1L66l6SOADpmyHjT7alHRiKhQi1qTcJLlr8tE UkxKKy8WribSfqQiD6JZzUEKf+ACIXqbhZYyCw5sPm3cYkbOCGBE/hb0S/WVIoLQq7m4 ENN21orhkfENr2/wE+1mbKVzM38alnKCrGkjzMSzCUXNSKsUd5W7y9T+JFVs58pdXme/ /N260FqQ6uSOds1FNoPgpq1/Izord3ALzjyN1l3M+Jvau7Dj3hmm0SVVfQZCM91dN1al wSOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=GDrgaRxsjr4153TYQDJZMyxDLyTjHkGDXJiVS+lHZns=; b=JjjCqYw5fHwsrRhT6gPQNrSjiKEr5PetX2+YbBbB0Iy3RhVpWgwu8fgeaLTFDSdlNF jGM63lCGWHR8tFzPcXIfr0AfAs+fXR240AkO2UrE8sx6SyqOBbQrCoRUYRiew/ieUL4g OeZ7XtDOoiWQolLhvNNOHXbeCk6LAHSx1iAZhsP1PdllRfeb6I/4GBfs7vfLH1lejIvu peQMjmsJ8S8Sg9QIMOSBXoT2NCvu7ik6YJ0+wUOMgI688QnylF8N3ul5xtwend0l7x8l kZxr+TJO1IjIHavgtTvY0y6IXcn0Vw63HDfsyno1H90r7dB5+a/lBKsBoFm1ZEwruYoW IWxg== 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 bf1si12148266edb.359.2021.04.04.10.54.24; Sun, 04 Apr 2021 10:54:47 -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 S231309AbhDDRuq (ORCPT + 99 others); Sun, 4 Apr 2021 13:50:46 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:45885 "EHLO relay7-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231284AbhDDRup (ORCPT ); Sun, 4 Apr 2021 13:50:45 -0400 X-Originating-IP: 78.45.89.65 Received: from im-t490s.redhat.com (ip-78-45-89-65.net.upcbroadband.cz [78.45.89.65]) (Authenticated sender: i.maximets@ovn.org) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 3089B20003; Sun, 4 Apr 2021 17:50:37 +0000 (UTC) From: Ilya Maximets To: Pravin B Shelar Cc: "David S. Miller" , Jakub Kicinski , Yi-Hung Wei , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Ilya Maximets Subject: [PATCH net] openvswitch: fix send of uninitialized stack memory in ct limit reply Date: Sun, 4 Apr 2021 19:50:31 +0200 Message-Id: <20210404175031.3834734-1-i.maximets@ovn.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org '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); } -- 2.26.2