Skip to content

Commit

Permalink
openvswitch: fix send of uninitialized stack memory in ct limit reply
Browse files Browse the repository at this point in the history
'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: 11efd5c ("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>
  • Loading branch information
Ilya Maximets authored and David S. Miller committed Apr 5, 2021
1 parent a14d273 commit 4d51419
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions net/openvswitch/conntrack.c
Original file line number Diff line number Diff line change
Expand Up @@ -2034,10 +2034,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);
}
Expand Down

0 comments on commit 4d51419

Please sign in to comment.