[libvirt] [PATCH 1/3] node device: Fix locking issue in virNodeDeviceDestroy
Cole Robinson
crobinso at redhat.com
Tue Oct 20 19:42:28 UTC 2009
On 10/19/2009 05:28 PM, Dave Allan wrote:
> Cole Robinson wrote:
>> Certain error paths won't unlock the node device object.
>>
>> Signed-off-by: Cole Robinson <crobinso at 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);
>
> ACK to this patch. I think this way to do the unlock in the error case
> is correct. (I don't agree with Matthias' comment. As the code stands
> now, either way will work, but this way protects against problems in
> code that is added in the future.)
I agree, more future proof, and follows the same conventions of the
other code in node_device_driver.c
I've pushed this change now.
Thanks,
Cole
More information about the libvir-list
mailing list