dpif-linux: Recheck the socket pointer existence before getting its pid.
authorAlex Wang <alexw@nicira.com>
Tue, 8 Jul 2014 04:58:33 +0000 (21:58 -0700)
committerAlex Wang <alexw@nicira.com>
Tue, 8 Jul 2014 05:12:22 +0000 (22:12 -0700)
commit49872bed7b294889ff430e82f4d8f57388ceee56
treee350cd0c6a23bf7e58fc5acd440b42e7c0574afa
parent02864c704ef33e3eb25ca15d812c29dee57cd80f
dpif-linux: Recheck the socket pointer existence before getting its pid.

This commit fixes a race between port deletion and flow miss handling.
More specifically, a port could be removed by main thread while
the handler thread is handling the flow miss from it.  If the flow
requires slow path action, the handler thread will try querying a pid
from port's socket.  Since the port has been deleted, the query will
cause a dereference of NULL socket pointer.

This commit makes the handler thread recheck the socket pointer before
dereferencing it.

VMware-BZ: 1251981

Reported-by: Pratap Reddy <preddy@nicira.com>
Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
lib/dpif-linux.c