Skip to content

Commit 0fff9bd

Browse files
kengiterdavem330
authored andcommitted
net: openvswitch: fix missing checks for nla_nest_start
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> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 6f19893 commit 0fff9bd

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎net/openvswitch/datapath.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,10 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
464464

465465
if (upcall_info->egress_tun_info) {
466466
nla = nla_nest_start(user_skb, OVS_PACKET_ATTR_EGRESS_TUN_KEY);
467+
if (!nla) {
468+
err = -EMSGSIZE;
469+
goto out;
470+
}
467471
err = ovs_nla_put_tunnel_info(user_skb,
468472
upcall_info->egress_tun_info);
469473
BUG_ON(err);
@@ -472,6 +476,10 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
472476

473477
if (upcall_info->actions_len) {
474478
nla = nla_nest_start(user_skb, OVS_PACKET_ATTR_ACTIONS);
479+
if (!nla) {
480+
err = -EMSGSIZE;
481+
goto out;
482+
}
475483
err = ovs_nla_put_actions(upcall_info->actions,
476484
upcall_info->actions_len,
477485
user_skb);

0 commit comments

Comments
 (0)