[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 1/3] node device: Fix locking issue in virNodeDeviceDestroy



2009/10/16 Cole Robinson <crobinso redhat com>:
> Certain error paths won't unlock the node device object.
>
> Signed-off-by: Cole Robinson <crobinso redhat com>
> ---
>  src/node_device/node_device_driver.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
> index 14b3098..21a4c8d 100644
> --- a/src/node_device/node_device_driver.c
> +++ b/src/node_device/node_device_driver.c
> @@ -720,6 +720,8 @@ nodeDeviceDestroy(virNodeDevicePtr dev)
>     }
>
>  out:
> +    if (obj)
> +        virNodeDeviceObjUnlock(obj);
>     VIR_FREE(parent_name);
>     VIR_FREE(wwnn);
>     VIR_FREE(wwpn);
> --
> 1.6.0.6
>

The only error path that won't unlock the node device object if the
get_wwns() one. I would suggest to put the unlock call there:

diff --git a/src/node_device/node_device_driver.c
b/src/node_device/node_device_driver.c
index 14b3098..43876c3 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -686,6 +686,7 @@ nodeDeviceDestroy(virNodeDevicePtr dev)
     }

     if (get_wwns(dev->conn, obj->def, &wwnn, &wwpn) == -1) {
+        virNodeDeviceObjUnlock(obj);
         goto out;
     }


Matthias


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]