Skip to content

Commit 4d51419

Browse files
igsilyadavem330
authored andcommitted
openvswitch: fix send of uninitialized stack memory in ct limit reply
'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 <[email protected]> Acked-by: Tonghao Zhang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a14d273 commit 4d51419

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

net/openvswitch/conntrack.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2034,10 +2034,10 @@ static int ovs_ct_limit_del_zone_limit(struct nlattr *nla_zone_limit,
20342034
static int ovs_ct_limit_get_default_limit(struct ovs_ct_limit_info *info,
20352035
struct sk_buff *reply)
20362036
{
2037-
struct ovs_zone_limit zone_limit;
2038-
2039-
zone_limit.zone_id = OVS_ZONE_LIMIT_DEFAULT_ZONE;
2040-
zone_limit.limit = info->default_limit;
2037+
struct ovs_zone_limit zone_limit = {
2038+
.zone_id = OVS_ZONE_LIMIT_DEFAULT_ZONE,
2039+
.limit = info->default_limit,
2040+
};
20412041

20422042
return nla_put_nohdr(reply, sizeof(zone_limit), &zone_limit);
20432043
}

0 commit comments

Comments
 (0)