[libvirt] [PATCH] Fix crash in nwfilter driver check

Stefan Berger stefanb at us.ibm.com
Mon Apr 19 13:44:37 UTC 2010


libvir-list-bounces at redhat.com wrote on 04/19/2010 09:18:15 AM:

> 
> * src/nwfilter/nwfilter_driver.c: Fix locking & NULL checks
>   in nwfilterDriverActive()
> ---
>  src/nwfilter/nwfilter_driver.c |   11 +++++++++--
>  1 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/src/nwfilter/nwfilter_driver.c 
b/src/nwfilter/nwfilter_driver.c
> index 58df4e1..412c5b8 100644
> --- a/src/nwfilter/nwfilter_driver.c
> +++ b/src/nwfilter/nwfilter_driver.c
> @@ -153,9 +153,16 @@ nwfilterDriverReload(void) {
>   */
>  static int
>  nwfilterDriverActive(void) {
> -    if (!driverState->pools.count)
> +    int ret;
> +
> +    if (!driverState)
>          return 0;
> -    return 1;
> +
> +    nwfilterDriverLock(driverState);
> +    ret = driverState->pools.count ? 1 : 0;
> +    nwfilterDriverUnlock(driverState);
> +
> +    return ret;
>  }
> 

ACK.

  Stefan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100419/8934fb18/attachment-0001.htm>


More information about the libvir-list mailing list