[libvirt] [PATCH] Fix incorrect path length check in sanlock lockspace setup

Daniel P. Berrange berrange at redhat.com
Tue Aug 30 16:25:16 UTC 2011


The code for creating a sanlock lockspace accidentally used
SANLK_NAME_LEN instead of SANLK_PATH_LEN for a size check.
This meant disk paths were limited to 48 bytes !

* src/locking/lock_driver_sanlock.c: Fix disk path length
  check
---
 src/locking/lock_driver_sanlock.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
index b85f1fa..b93fe01 100644
--- a/src/locking/lock_driver_sanlock.c
+++ b/src/locking/lock_driver_sanlock.c
@@ -159,10 +159,10 @@ static int virLockManagerSanlockSetupLockspace(void)
     memcpy(ls.name, VIR_LOCK_MANAGER_SANLOCK_AUTO_DISK_LOCKSPACE, SANLK_NAME_LEN);
     ls.host_id = 0; /* Doesn't matter for initialization */
     ls.flags = 0;
-    if (!virStrcpy(ls.host_id_disk.path, path, SANLK_NAME_LEN)) {
+    if (!virStrcpy(ls.host_id_disk.path, path, SANLK_PATH_LEN)) {
         virLockError(VIR_ERR_INTERNAL_ERROR,
                      _("Lockspace path '%s' exceeded %d characters"),
-                     path, SANLK_NAME_LEN);
+                     path, SANLK_PATH_LEN);
         goto error;
     }
     ls.host_id_disk.offset = 0;
-- 
1.7.4.4




More information about the libvir-list mailing list