* [PATCH] net: openvswitch: fix missing checks for nla_nest_start
@ 2019-03-15 6:11 Kangjie Lu
2019-03-16 18:43 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Kangjie Lu @ 2019-03-15 6:11 UTC (permalink / raw)
To: kjlu
Cc: pakki001, Pravin B Shelar, David S. Miller, netdev, dev, linux-kernel
nla_nest_start may fail and thus deserves a check.
The fix returns -EMSGSIZE when it fails.
Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
net/openvswitch/datapath.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 45d1469308b0..9dd158ab51b3 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -464,6 +464,10 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
if (upcall_info->egress_tun_info) {
nla = nla_nest_start(user_skb, OVS_PACKET_ATTR_EGRESS_TUN_KEY);
+ if (!nla) {
+ err = -EMSGSIZE;
+ goto out;
+ }
err = ovs_nla_put_tunnel_info(user_skb,
upcall_info->egress_tun_info);
BUG_ON(err);
@@ -472,6 +476,10 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
if (upcall_info->actions_len) {
nla = nla_nest_start(user_skb, OVS_PACKET_ATTR_ACTIONS);
+ if (!nla) {
+ err = -EMSGSIZE;
+ goto out;
+ }
err = ovs_nla_put_actions(upcall_info->actions,
upcall_info->actions_len,
user_skb);
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: openvswitch: fix missing checks for nla_nest_start
2019-03-15 6:11 [PATCH] net: openvswitch: fix missing checks for nla_nest_start Kangjie Lu
@ 2019-03-16 18:43 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-03-16 18:43 UTC (permalink / raw)
To: kjlu; +Cc: pakki001, pshelar, netdev, dev, linux-kernel
From: Kangjie Lu <kjlu@umn.edu>
Date: Fri, 15 Mar 2019 01:11:22 -0500
> nla_nest_start may fail and thus deserves a check.
> The fix returns -EMSGSIZE when it fails.
>
> 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:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-15 6:11 [PATCH] net: openvswitch: fix missing checks for nla_nest_start Kangjie Lu
2019-03-16 18:43 ` 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).