]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
openvswitch: fix send of uninitialized stack memory in ct limit reply
authorIlya Maximets <i.maximets@ovn.org>
Sun, 4 Apr 2021 17:50:31 +0000 (19:50 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 7 May 2021 07:53:40 +0000 (09:53 +0200)
BugLink: https://bugs.launchpad.net/bugs/1926368
[ Upstream commit 4d51419d49930be2701c2633ae271b350397c3ca ]

'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>
Acked-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
net/openvswitch/conntrack.c

index 5eddfe7bd3910a0f4cc47d3daa01bbabd6bbe32e..2316efd6ace8b6f1b357e479f81092c37443fecf 100644 (file)
@@ -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);
 }