mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 23:25:24 +00: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:
parent
3022375da3
commit
98bd5e6c5a
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user