Skip to contentSkip to conversation

net: openvswitch: fix a NULL pointer dereference

PATCH Applied Kangjie Lu 2 participants 2 messages Mar 15, 2019 – Mar 16, 2019

Subsystems (3)
lore
Share & tools
lore

Kangjie Lu

author
#0 lore raw

PATCH 1/1 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.

---
 net/openvswitch/datapath.c | 4 ++++
 1 file changed, 4 insertions(+)
net/openvswitch/datapath.c +4 -0
index 6679e96ab1dc..45d1469308b0 100644
@@ -448,6 +448,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);
Signature · 1 line
2.17.1