ofproto-dpif-upcall: Fix ovs-vswitchd crash.
authorAlex Wang <alexw@nicira.com>
Tue, 22 Apr 2014 00:31:11 +0000 (17:31 -0700)
committerAlex Wang <alexw@nicira.com>
Tue, 22 Apr 2014 01:44:09 +0000 (18:44 -0700)
commit1f8675481e8cc976931bd0a85851d780f7cf2a33
tree4e2aba64266d1f4dec8b3f7b65df5a7b54274620
parenta605908001070c27aa8c755c92cd361a10b46beb
ofproto-dpif-upcall: Fix ovs-vswitchd crash.

On current master, caller of udpif_set_threads() can pass 0 value
on n_handlers and n_revalidators to delete all handler and revalidator
threads.

After commit 9a159f748866 (ofproto-dpif-upcall: Remove the dispatcher
thread.), udpif_set_threads() also calls the dpif_handlers_set() with
the 0 value 'n_handlers'.  Since dpif level always assume the 'n_handlers'
be non-zero, this causes warnings and even crash of ovs-vswitchd.

This commit fixes the above issue by defining separate functions for
starting and stopping handler and revalidator threads.  So
udpif_set_threads() will never be called with 0 value arguments.

Reported-by: Andy Zhou <azhou@nicira.com>
Signed-off-by: Alex Wang <alexw@nicira.com>
Co-authored-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
ofproto/ofproto-dpif-upcall.c