openvswitch tests for nla_nest_start
Subsystems (3)
cover openvswitch tests for nla_nest_start
Coverity is looking for bugs here, and a couple of new bugzilla reports showed up where nla_nest_start return is not checked for NULL.
Stephen Hemminger (2):
openvswitch: check for null return for nla_nest_start
openvswitch: check for null return for nla_nest_start in datapath
net/openvswitch/conntrack.c | 2 ++ net/openvswitch/datapath.c | 8 ++++++++ 2 files changed, 10 insertions(+)
Signature · 1 line
2.18.0
PATCH 1/2 openvswitch: check for null return for nla_nest_start
The call to nla_nest_start in conntrack can lead to a NULL return so it's possible for attr to become NULL and we can potentially get a NULL pointer dereference on attr. Fix this by checking for a NULL return.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=200533
--- net/openvswitch/conntrack.c | 2 ++ 1 file changed, 2 insertions(+)
net/openvswitch/conntrack.c +2 -0
@@ -2132,6 +2132,8 @@ static int ovs_ct_limit_cmd_get(struct sk_buff *skb, struct genl_info *info)return PTR_ERR (reply); nla_reply =nla_nest_start (reply,OVS_CT_LIMIT_ATTR_ZONE_LIMIT ); +if (!nla_reply) +return PRT_ERR (-EMSGSIZE );if (a[OVS_CT_LIMIT_ATTR_ZONE_LIMIT ]) { err = ovs_ct_limit_get_zone_limit(
Signature · 1 line
2.18.0
A message that is not in the archive (sent off-list or not yet received): 20180718161216.27820-2-sthemmin-0li6OtcxBFHby3iVrkZq2A@public.gmane.org
Pravin Shelar
Acked-byRe: [PATCH net 1/2] openvswitch: check for null return for nla_nest_start
Quoted 17 lines · Stephen Hemminger
The call to
nla_nest_startin conntrack can lead to a NULL return so it's possible for attr to become NULL and we can potentially get a NULL pointer dereference on attr. Fix this by checking for a NULL return.Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=200533
Fixes 11efd5cb04a1 ("openvswitch: Support conntrack zone limit")Signed-off-by Stephen Hemminger <[email protected]>--- net/openvswitch/conntrack.c | 2 ++ 1 file changed, 2 insertions(+)net/openvswitch/conntrack.c +0
-0
net/openvswitch/conntrack.c static int ovs_ct_limit_cmd_get(struct sk_buff *skb, struct genl_info *info)
Quoted 9 lines
net/openvswitch/conntrack.c +2
-1@@ -2132,6 +2132,8 @@ static int ovs_ct_limit_cmd_get(struct sk_buff *skb, struct genl_info *info)return PTR_ERR (reply); nla_reply =nla_nest_start (reply,OVS_CT_LIMIT_ATTR_ZONE_LIMIT ); +if (!nla_reply) +return PRT_ERR (-EMSGSIZE );if (a[OVS_CT_LIMIT_ATTR_ZONE_LIMIT ]) { err = ovs_ct_limit_get_zone_limit( --
Thanks.
PATCH 2/2 openvswitch: check for null return for nla_nest_start in datapath
In reply to Stephen HemmingerThe call to nla_nest_start when forming packet messages can lead to a NULL return so it's possible for attr to become NULL and we can potentially get a NULL pointer dereference on attr. Fix this by checking for a NULL return.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=200537
--- net/openvswitch/datapath.c | 8 ++++++++ 1 file changed, 8 insertions(+)
net/openvswitch/datapath.c +8 -0
@@ -460,6 +460,10 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,if (upcall_info->egress_tun_info) { nla =nla_nest_start (user_skb,OVS_PACKET_ATTR_EGRESS_TUN_KEY ); +if (!nla) { + err = -EMSGSIZE ; + goto out; + } err =ovs_nla_put_tunnel_info (user_skb, upcall_info->egress_tun_info);BUG_ON (err);
@@ -468,6 +472,10 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,if (upcall_info->actions_len) { nla =nla_nest_start (user_skb,OVS_PACKET_ATTR_ACTIONS ); +if (!nla) { + err = -EMSGSIZE ; + goto out; + } err =ovs_nla_put_actions (upcall_info->actions, upcall_info->actions_len, user_skb);
Signature · 1 line
2.18.0
A message that is not in the archive (sent off-list or not yet received): 20180718161216.27820-3-sthemmin-0li6OtcxBFHby3iVrkZq2A@public.gmane.org
Pravin Shelar
Acked-byRe: [PATCH net 2/2] openvswitch: check for null return for nla_nest_start in datapath
Quoted 28 lines · Stephen Hemminger
The call to
nla_nest_startwhen forming packet messages can lead to a NULL return so it's possible for attr to become NULL and we can potentially get a NULL pointer dereference on attr. Fix this by checking for a NULL return.Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=200537
Fixes 8f0aad6f35f7 ("openvswitch: Extend packet attribute for egress tunnel info")Signed-off-by Stephen Hemminger <[email protected]>--- net/openvswitch/datapath.c | 8 ++++++++ 1 file changed, 8 insertions(+)net/openvswitch/datapath.c +4
-0@@ -460,6 +460,10 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,if (upcall_info->egress_tun_info) { nla =nla_nest_start (user_skb,OVS_PACKET_ATTR_EGRESS_TUN_KEY ); +if (!nla) { + err = -EMSGSIZE ; + goto out; + } err =ovs_nla_put_tunnel_info (user_skb, upcall_info->egress_tun_info);BUG_ON (err);
net/openvswitch/datapath.c static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb, · line 481
Quoted 10 lines
net/openvswitch/datapath.c +4
-0@@ -468,6 +472,10 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,if (upcall_info->actions_len) { nla =nla_nest_start (user_skb,OVS_PACKET_ATTR_ACTIONS ); +if (!nla) { + err = -EMSGSIZE ; + goto out; + } err =ovs_nla_put_actions (upcall_info->actions, upcall_info->actions_len, user_skb);
Thanks.
David Miller
maintainerFrom: Stephen Hemminger <[email protected]>
Date: Wed, 18 Jul 2018 09:12:14 -0700
Quoted 3 lines
Coverity is looking for bugs here, and a couple of new bugzilla reports showed up where
nla_nest_startreturn is not checked for NULL.
Series applied and patch #2 queued up for -stable, thanks Stephen.
David Miller
maintainerFrom: David Miller <[email protected]>
Date: Fri, 20 Jul 2018 12:15:36 -0700 (PDT)
Quoted 8 lines
From: Stephen Hemminger <[email protected]>
Date: Wed, 18 Jul 2018 09:12:14 -0700Quoted 3 lines
Coverity is looking for bugs here, and a couple of new bugzilla reports showed up where
nla_nest_startreturn is not checked for NULL.Series applied and patch #2 queued up for -stable, thanks Stephen.
Actually, this wasn't compile tested and fails to build. :-/
Please fix this and resubmit.
Thanks.