From c848509178d109f84cc3fc6df4d0c7d728f39f44 Mon Sep 17 00:00:00 2001 From: Kangjie Lu Date: Wed, 10 Apr 2019 13:25:20 +0000 Subject: [PATCH] net: openvswitch: fix a NULL pointer dereference mainline inclusion from mainline-5.1-rc3 commit 6f19893b644a category: bugfix bugzilla: 13294 CVE: NA ------------------------------------------------- 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 Signed-off-by: David S. Miller Signed-off-by: Zhiqiang Liu Reviewed-by: Wenan Mao Signed-off-by: Yang Yingliang --- net/openvswitch/datapath.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index 0f5ce77460d4..f9411a049def 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, 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); -- GitLab