提交 98bd5e6c 编写于 作者: D Daniel P. Berrange

Fix crash in nwfilter driver check

The nwfilterDriverActive() could de-reference a NULL pointer
if it hadn't be started at the point it was called. It was
also not thread safe, since it lacked locking around data
accesses.

* src/nwfilter/nwfilter_driver.c: Fix locking & NULL checks
  in nwfilterDriverActive()
上级 3022375d
...@@ -164,9 +164,16 @@ nwfilterDriverReload(void) { ...@@ -164,9 +164,16 @@ nwfilterDriverReload(void) {
*/ */
static int static int
nwfilterDriverActive(void) { nwfilterDriverActive(void) {
if (!driverState->pools.count) int ret;
if (!driverState)
return 0; return 0;
return 1;
nwfilterDriverLock(driverState);
ret = driverState->pools.count ? 1 : 0;
nwfilterDriverUnlock(driverState);
return ret;
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册