From: Kangjie Lu <k...@umn.edu>

Upstream commit:
    commit 0fff9bd47e1341b5c4db862cc39fc68ce45f165d
    Author: Kangjie Lu <k...@umn.edu>
    Date:   Fri Mar 15 01:11:22 2019 -0500

    net: openvswitch: fix missing checks for nla_nest_start

    nla_nest_start may fail and thus deserves a check.
    The fix returns -EMSGSIZE when it fails.

    Signed-off-by: Kangjie Lu <k...@umn.edu>
    Signed-off-by: David S. Miller <da...@davemloft.net>

Cc: Kangjie Lu <k...@umn.edu>
Signed-off-by: Greg Rose <gvrose8...@gmail.com>
---
 datapath/datapath.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/datapath/datapath.c b/datapath/datapath.c
index 1340d6b..94e4f6f 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -476,6 +476,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);
@@ -484,6 +488,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);
-- 
1.8.3.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to