aboutsummaryrefslogtreecommitdiffstats
path: root/net/openvswitch/flow.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/openvswitch/flow.c')
-rw-r--r--net/openvswitch/flow.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c
index 1252c3081ef1..7cb416381e87 100644
--- a/net/openvswitch/flow.c
+++ b/net/openvswitch/flow.c
@@ -1174,11 +1174,13 @@ int ovs_flow_to_nlattrs(const struct sw_flow_key *swkey, struct sk_buff *skb)
1174 struct ovs_key_ethernet *eth_key; 1174 struct ovs_key_ethernet *eth_key;
1175 struct nlattr *nla, *encap; 1175 struct nlattr *nla, *encap;
1176 1176
1177 if (swkey->phy.priority) 1177 if (swkey->phy.priority &&
1178 NLA_PUT_U32(skb, OVS_KEY_ATTR_PRIORITY, swkey->phy.priority); 1178 nla_put_u32(skb, OVS_KEY_ATTR_PRIORITY, swkey->phy.priority))
1179 goto nla_put_failure;
1179 1180
1180 if (swkey->phy.in_port != USHRT_MAX) 1181 if (swkey->phy.in_port != USHRT_MAX &&
1181 NLA_PUT_U32(skb, OVS_KEY_ATTR_IN_PORT, swkey->phy.in_port); 1182 nla_put_u32(skb, OVS_KEY_ATTR_IN_PORT, swkey->phy.in_port))
1183 goto nla_put_failure;
1182 1184
1183 nla = nla_reserve(skb, OVS_KEY_ATTR_ETHERNET, sizeof(*eth_key)); 1185 nla = nla_reserve(skb, OVS_KEY_ATTR_ETHERNET, sizeof(*eth_key));
1184 if (!nla) 1186 if (!nla)
@@ -1188,8 +1190,9 @@ int ovs_flow_to_nlattrs(const struct sw_flow_key *swkey, struct sk_buff *skb)
1188 memcpy(eth_key->eth_dst, swkey->eth.dst, ETH_ALEN); 1190 memcpy(eth_key->eth_dst, swkey->eth.dst, ETH_ALEN);
1189 1191
1190 if (swkey->eth.tci || swkey->eth.type == htons(ETH_P_8021Q)) { 1192 if (swkey->eth.tci || swkey->eth.type == htons(ETH_P_8021Q)) {
1191 NLA_PUT_BE16(skb, OVS_KEY_ATTR_ETHERTYPE, htons(ETH_P_8021Q)); 1193 if (nla_put_be16(skb, OVS_KEY_ATTR_ETHERTYPE, htons(ETH_P_8021Q)) ||
1192 NLA_PUT_BE16(skb, OVS_KEY_ATTR_VLAN, swkey->eth.tci); 1194 nla_put_be16(skb, OVS_KEY_ATTR_VLAN, swkey->eth.tci))
1195 goto nla_put_failure;
1193 encap = nla_nest_start(skb, OVS_KEY_ATTR_ENCAP); 1196 encap = nla_nest_start(skb, OVS_KEY_ATTR_ENCAP);
1194 if (!swkey->eth.tci) 1197 if (!swkey->eth.tci)
1195 goto unencap; 1198 goto unencap;
@@ -1200,7 +1203,8 @@ int ovs_flow_to_nlattrs(const struct sw_flow_key *swkey, struct sk_buff *skb)
1200 if (swkey->eth.type == htons(ETH_P_802_2)) 1203 if (swkey->eth.type == htons(ETH_P_802_2))
1201 goto unencap; 1204 goto unencap;
1202 1205
1203 NLA_PUT_BE16(skb, OVS_KEY_ATTR_ETHERTYPE, swkey->eth.type); 1206 if (nla_put_be16(skb, OVS_KEY_ATTR_ETHERTYPE, swkey->eth.type))
1207 goto nla_put_failure;
1204 1208
1205 if (swkey->eth.type == htons(ETH_P_IP)) { 1209 if (swkey->eth.type == htons(ETH_P_IP)) {
1206 struct ovs_key_ipv4 *ipv4_key; 1210 struct ovs_key_ipv4 *ipv4_key;