xt_exit_row_locks() tries to release unallocated locks

Bug #782435 reported by Vladislav Vaintroub
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MariaDB
Fix Released
Medium
Vladislav Vaintroub
PBXT
Fix Committed
Undecided
Vladimir Kolesnikov

Bug Description

Sometimes (e.g during table creation), xt_exit_row_locks() is called without the corresponding xt_init_row_locks() .
This leads to at attempt to release unallocated locks in
   xt_spinlock_free(NULL, &rl->rl_groups[i].lg_lock);

This makes Windows application verifier unhappy on x64.

Quick fix:
== verändert Datei storage/pbxt/src/lock_xt.cc
--- storage/pbxt/src/lock_xt.cc 2011-04-07 16:28:52 +0000
+++ storage/pbxt/src/lock_xt.cc 2011-05-13 22:56:00 +0000
@@ -726,11 +726,15 @@
   rl->rl_groups[i].lg_list_in_use = 0;
   rl->rl_groups[i].lg_list = NULL;
  }
+ rl->valid = 1;
  return OK;
 }

 void xt_exit_row_locks(XTRowLocksPtr rl)
 {
+ if (!rl->valid)
+ return;
+
  for (int i=0; i<XT_ROW_LOCK_GROUP_COUNT; i++) {
   xt_spinlock_free(NULL, &rl->rl_groups[i].lg_lock);
   rl->rl_groups[i].lg_wait_queue = NULL;
@@ -741,6 +745,7 @@
    rl->rl_groups[i].lg_list = NULL;
   }
  }
+ rl->valid = 0;
 }

 /*

=== verändert Datei storage/pbxt/src/lock_xt.h
--- storage/pbxt/src/lock_xt.h 2010-05-06 12:57:15 +0000
+++ storage/pbxt/src/lock_xt.h 2011-05-13 22:51:41 +0000
@@ -658,6 +658,7 @@
 struct XTLockWait;

 typedef struct XTRowLocks {
+ int valid;
  XTLockGroupRec rl_groups[XT_ROW_LOCK_GROUP_COUNT];

  void xt_cancel_temp_lock(XTLockWaitPtr lw);

Related branches

description: updated
Revision history for this message
Vladislav Vaintroub (wlad-montyprogram) wrote :

Fixed in MariaDB 5.2.7

Changed in maria:
assignee: nobody → Vladislav Vaintroub (wlad-montyprogram)
importance: Undecided → Medium
milestone: none → 5.2
Changed in pbxt:
status: New → Fix Committed
assignee: nobody → Vladimir Kolesnikov (vkolesnikov)
Changed in maria:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.