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:31 +0000 (14:22 -0700)
commitcffabec1bb6fb60dcf3d34c8606dfcfa1fb68f74
treebf2b865abb295c26cf3ab50ce840f6b75d307245
parentab6b255021d412f96ca383e556327f7ddb232d31
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