mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
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()
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user