linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: openvswitch: fix a NULL pointer dereference
@ 2019-03-15  4:20 Kangjie Lu
  2019-03-16 18:36 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Kangjie Lu @ 2019-03-15  4:20 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Pravin B Shelar, David S. Miller, netdev, dev, linux-kernel

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>
---
 net/openvswitch/datapath.c | 4 ++++
 1 file changed, 4 insertions(+)

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,
 
 	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);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: openvswitch: fix a NULL pointer dereference
  2019-03-15  4:20 [PATCH] net: openvswitch: fix a NULL pointer dereference Kangjie Lu
@ 2019-03-16 18:36 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-03-16 18:36 UTC (permalink / raw)
  To: kjlu; +Cc: pakki001, pshelar, netdev, dev, linux-kernel

From: Kangjie Lu <kjlu@umn.edu>
Date: Thu, 14 Mar 2019 23:20:16 -0500

> 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>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-16 18:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-15  4:20 [PATCH] net: openvswitch: fix a NULL pointer dereference Kangjie Lu
2019-03-16 18:36 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).