[libvirt] [PATCH 1/4] nodedev: Add check for NULL obj before call Unlock

John Ferlan posted 4 patches 7 years, 10 months ago
[libvirt] [PATCH 1/4] nodedev: Add check for NULL obj before call Unlock
Posted by John Ferlan 7 years, 10 months ago
Commit id '95ea171b' was a bit too aggressive in removing the if (obj)
check since cleanup is reachable after Unlock and obj = NULL.

Signed-off-by: John Ferlan <jferlan@redhat.com>
---
 src/node_device/node_device_driver.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index bc5c0e5..5bf202e 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -650,7 +650,8 @@ nodeDeviceDestroy(virNodeDevicePtr dev)
 
  cleanup:
     nodeDeviceUnlock();
-    virNodeDeviceObjUnlock(obj);
+    if (obj)
+        virNodeDeviceObjUnlock(obj);
     VIR_FREE(wwnn);
     VIR_FREE(wwpn);
     return ret;
-- 
2.9.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/4] nodedev: Add check for NULL obj before call Unlock
Posted by Peter Krempa 7 years, 10 months ago
On Wed, Jun 28, 2017 at 07:37:35 -0400, John Ferlan wrote:
> Commit id '95ea171b' was a bit too aggressive in removing the if (obj)
> check since cleanup is reachable after Unlock and obj = NULL.
> 
> Signed-off-by: John Ferlan <jferlan@redhat.com>
> ---
>  src/node_device/node_device_driver.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

ACK
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list