Skip to contentSkip to conversation

FAILED: Patch "openvswitch: fix send of uninitialized stack memory in ct limit reply" failed to apply to 4.19-stable tree

PATCH Sasha Levin 1 participant 1 message Apr 12, 2021

Subsystems (3)
lore
Share & tools
lore

Sasha Levin

author maintainer
#0 lore raw

The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

Thanks,
Sasha

------------------ original commit in Linus's tree ------------------

From 4d51419d49930be2701c2633ae271b350397c3ca Mon Sep 17 00:00:00 2001
From: Ilya Maximets <[email protected]>
Date: Sun, 4 Apr 2021 19:50:31 +0200
Subject: [PATCH] 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 11efd5cb04a1 ("openvswitch: Support conntrack zone limit")
---
 net/openvswitch/conntrack.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
net/openvswitch/conntrack.c +4 -4
index 71cec03e8612..d217bd91176b 100644
@@ -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);
 }
Signature · 1 line
2.30.2