2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-22 01:51:26 +00:00

ofproto-dpif-upcall: Check odp_tun_key_from_attr() return value.

In the IPFIX and flow sample upcall handling, check the validity
of the tunnel key returned by odp_tun_key_from_attr(). If the
tunnel key is invalid, return an error.

This was reported by Coverity, but the change also improves
robustness and avoids undefined behavior in the case of malformed
tunnel attributes.

Fixes: 8b7ea2d48033 ("Extend OVS IPFIX exporter to export tunnel headers")
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Aaron Conole <aconole@redhat.com>
This commit is contained in:
Eelco Chaudron 2025-06-05 16:51:27 +02:00
parent 88737f02ed
commit d1bd62dae5

View File

@ -1563,8 +1563,11 @@ process_upcall(struct udpif *udpif, struct upcall *upcall,
memset(&ipfix_actions, 0, sizeof ipfix_actions);
if (upcall->out_tun_key) {
odp_tun_key_from_attr(upcall->out_tun_key, &output_tunnel_key,
NULL);
if (odp_tun_key_from_attr(upcall->out_tun_key,
&output_tunnel_key,
NULL) != ODP_FIT_ERROR) {
return EINVAL;
}
}
actions_len = dpif_read_actions(udpif, upcall, flow,