summaryrefslogtreecommitdiffstats
path: root/net/openvswitch/datapath.c
diff options
context:
space:
mode:
authorKangjie Lu <kjlu@umn.edu>2019-03-15 00:20:16 -0400
committerDavid S. Miller <davem@davemloft.net>2019-03-16 14:35:58 -0400
commit6f19893b644a9454d85e593b5e90914e7a72b7dd (patch)
tree5a929c79029a9bc1158827051b8756bbcd0c7f5c /net/openvswitch/datapath.c
parent4477138fa0ae4e1b699786ef0600863ea6e6c61c (diff)
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 <kjlu@umn.edu> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/openvswitch/datapath.c')
-rw-r--r--net/openvswitch/datapath.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 6679e96ab1dc..45d1469308b0 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -448,6 +448,10 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
448 448
449 upcall = genlmsg_put(user_skb, 0, 0, &dp_packet_genl_family, 449 upcall = genlmsg_put(user_skb, 0, 0, &dp_packet_genl_family,
450 0, upcall_info->cmd); 450 0, upcall_info->cmd);
451 if (!upcall) {
452 err = -EINVAL;
453 goto out;
454 }
451 upcall->dp_ifindex = dp_ifindex; 455 upcall->dp_ifindex = dp_ifindex;
452 456
453 err = ovs_nla_put_key(key, key, OVS_PACKET_ATTR_KEY, false, user_skb); 457 err = ovs_nla_put_key(key, key, OVS_PACKET_ATTR_KEY, false, user_skb);