ipfix: Fix SIGFPE in bridge exporter sampling.
authorJoe Stringer <joestringer@nicira.com>
Fri, 11 Sep 2015 01:00:21 +0000 (18:00 -0700)
committerJoe Stringer <joestringer@nicira.com>
Fri, 11 Sep 2015 20:54:41 +0000 (13:54 -0700)
commita2abbcba98e989e9c7e944172488c7645cfc973c
tree020de00243c5b8584a71c4d299100b897c9b13fa
parent7b85919c5d32c563966e06bf5371e925c94ab445
ipfix: Fix SIGFPE in bridge exporter sampling.

A divide-by-zero exception like the below could occur when IPFIX
configuration is cleared while handling sampled packets from the
datapath. While it's not valid to configure the sampling probability of
IPFIX to zero via explicitly setting it in OVSDB, it is possible to
clear the configuration, which results in a probability of zero. In this
case, there is a window during which it is possible for upcalls to find
the cleared IPFIX object and attempt to perform sampling using it. Fix
the issue by ensuring that the probability is nonzero before using it.

"Program terminated with signal SIGFPE, Arithmetic exception."

dpif_ipfix_bridge_sample (...) at ../ofproto/ofproto-dpif-ipfix.c:1701
process_upcall (...) at ../ofproto/ofproto-dpif-upcall.c:1145
recv_upcalls (...) at ../ofproto/ofproto-dpif-upcall.c:705
udpif_upcall_handler (...) at ../ofproto/ofproto-dpif-upcall.c:631
ovsthread_wrapper (...) at ../lib/ovs-thread.c:340
start_thread (...) at pthread_create.c:312
clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Romain Lenglet <romain.lenglet@oracle.com>
ofproto/ofproto-dpif-ipfix.c