[ovs-dev] [PATCH branch-2.3] dpif-netdev: Avoid divide by zero.

Justin Pettit jpettit at nicira.com
Wed Aug 6 16:54:28 UTC 2014


Acked-by: Justin Pettit <jpettit at nicira.com>


On August 6, 2014 at 9:47:22 AM, Ben Pfaff (blp at nicira.com) wrote:
> Otherwise creating the first dpif-netdev bridge fails because there are
> no handlers:
> 
> Program terminated with signal 8, Arithmetic exception.
> #0 0x080971e9 in dp_execute_cb (aux_=aux_ at entry=0xffcfaa54,
> packet=packet at entry=0xffcfac54, md=md at entry=0xffcfac84,
> a=a at entry=0x8f58930, may_steal=false) at ../lib/dpif-netdev.c:2154
> #1 0x080b5adb in odp_execute_actions__ (dp=dp at entry=0xffcfaa54,
> packet=packet at entry=0xffcfac54, steal=steal at entry=false,
> md=md at entry=0xffcfac84, actions=actions at entry=0x8f58930,
> actions_len=actions_len at entry=20,
> dp_execute_action=dp_execute_action at entry=0x8097040 ,
> more_actions=more_actions at entry=false) at ../lib/odp-execute.c:218
> #2 0x080b5def in odp_execute_actions (dp=dp at entry=0xffcfaa54,
> packet=packet at entry=0xffcfac54, steal=steal at entry=false,
> md=md at entry=0xffcfac84, actions=0x8f58930, actions_len=20,
> dp_execute_action=dp_execute_action at entry=0x8097040 )
> at ../lib/odp-execute.c:285
> #3 0x08095098 in dp_netdev_execute_actions (actions_len=,
> actions=, md=0xffcfac84, may_steal=false,
> packet=0xffcfac54, key=0xffcfaa5c, dp=)
> at ../lib/dpif-netdev.c:2227
> #4 dpif_netdev_execute (dpif=0x8f59598, execute=0xffcfac78)
> at ../lib/dpif-netdev.c:1551
> #5 0x0809a56c in dpif_execute (dpif=0x8f59598,
> execute=execute at entry=0xffcfac78) at ../lib/dpif.c:1227
> #6 0x08071071 in check_variable_length_userdata (backer=)
> at ../ofproto/ofproto-dpif.c:1040
> #7 open_dpif_backer (backerp=0x8f5834c, type=)
> at ../ofproto/ofproto-dpif.c:921
> #8 construct (ofproto_=0x8f581c0) at ../ofproto/ofproto-dpif.c:1120
> #9 0x080675e0 in ofproto_create (datapath_name=0x8f57310 "br0",
> datapath_type=, ofprotop=ofprotop at entry=0x8f576c8)
> at ../ofproto/ofproto.c:564
> #10 0x080529aa in bridge_reconfigure (ovs_cfg=ovs_cfg at entry=0x8f596d8)
> at ../vswitchd/bridge.c:572
> #11 0x08055e33 in bridge_run () at ../vswitchd/bridge.c:2339
> #12 0x0804cdbd in main (argc=9, argv=0xffcfb554)
> at ../vswitchd/ovs-vswitchd.c:116
> 
> This bug was introduced by commit 9bcefb956d8f (ofproto-dpif: fix an ovs
> crash when dpif_recv_set returns error).
> 
> CC: Andy Zhou 
> Signed-off-by: Ben Pfaff 
> ---
> This bug is only on branch-2.3.
> 
> lib/dpif-netdev.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
> index 69e15d7..78f8636 100644
> --- a/lib/dpif-netdev.c
> +++ b/lib/dpif-netdev.c
> @@ -2150,11 +2150,13 @@ dp_execute_cb(void *aux_, struct ofpbuf *packet,
> 
> userdata = nl_attr_find_nested(a, OVS_USERSPACE_ATTR_USERDATA);
> 
> - dp_netdev_output_userspace(aux->dp, packet,
> - miniflow_hash_5tuple(aux->key, 0)
> + if (aux->dp->n_handlers > 0) {
> + dp_netdev_output_userspace(aux->dp, packet,
> + miniflow_hash_5tuple(aux->key, 0)
> % aux->dp->n_handlers,
> - DPIF_UC_ACTION, aux->key,
> - userdata);
> + DPIF_UC_ACTION, aux->key,
> + userdata);
> + }
> 
> if (may_steal) {
> ofpbuf_delete(packet);
> --
> 1.7.10.4
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
> 




More information about the dev mailing list