datapath: Add NULL check for mask pointer.
authorPravin B Shelar <pshelar@nicira.com>
Thu, 24 Jul 2014 20:32:35 +0000 (13:32 -0700)
committerPravin B Shelar <pshelar@nicira.com>
Fri, 25 Jul 2014 21:22:04 +0000 (14:22 -0700)
commit5fdbade3c1199eeac8a8584f3f320014665aa827
tree71d7342e203a86e27610fe842fa3762b617c3719
parentdf0e5f55763289e37f90d1f2464423f07478f372
datapath: Add NULL check for mask pointer.

There is race in datapath when last mask in mask array deleted can
result in NULL pointer dereference in datapath.
datapath lookup does not check mask pointer if its index is less than
mask-array count. That is safe because delete operation moves last valid
pointer to the deleted element. But this does not work if we are
deleting last element in array. Following patch adds NULL check for the
mask pointer.
This patch also avoids accessing ma->count without any locks.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
datapath/flow_table.c