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

Upstream commit:
    commit 6f19893b644a9454d85e593b5e90914e7a72b7dd
    Author: Kangjie Lu <k...@umn.edu>
    Date:   Thu Mar 14 23:20:16 2019 -0500

    net: openvswitch: fix a NULL pointer dereference

    upcall is dereferenced even when genlmsg_put fails. The fix
    goto out to avoid the NULL pointer dereference in this case.

    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 | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/datapath/datapath.c b/datapath/datapath.c
index 2febcb3..1340d6b 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -459,6 +459,10 @@ static int queue_userspace_packet(struct datapath *dp, 
struct sk_buff *skb,
 
        upcall = genlmsg_put(user_skb, 0, 0, &dp_packet_genl_family,
                             0, upcall_info->cmd);
+       if (!upcall) {
+               err = -EINVAL;
+               goto out;
+       }
        upcall->dp_ifindex = dp_ifindex;
 
        err = ovs_nla_put_key(key, key, OVS_PACKET_ATTR_KEY, false, user_skb);
-- 
1.8.3.1

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

Reply via email to