summaryrefslogtreecommitdiff
path: root/sql/sql_plugin.cc
diff options
context:
space:
mode:
authorAshish Agarwal <ashish.y.agarwal@oracle.com>2012-08-24 14:55:47 +0530
committerAshish Agarwal <ashish.y.agarwal@oracle.com>2012-08-24 14:55:47 +0530
commit8c239b09a27c3510b675e6a8b9370a25ffb6986d (patch)
tree3b983d2d41276249751cda79a768a93eb1a8070d /sql/sql_plugin.cc
parent9bc328a41ae6c7fbdde4167168206dfa9912ece0 (diff)
downloadmariadb-git-8c239b09a27c3510b675e6a8b9370a25ffb6986d.tar.gz
Bug#14363985: MYSQLD CRASHED WHEN DISABL AND
ENABLE AUDI PLUGIN WHEN DDL OPERATION HAPPENING PROBLEM: While unloading the plugin, state is not checked before it is to be reaped. This can lead to simultaneous free of plugin memory by more than one thread. Multiple deallocation leads to server crash. In the present bug two threads deallocate the alog_log plugin. SOLUTION: A check is added to ensure that only one thread is unloading the plugin. NOTE: No mtr test is added as it requires multiple threads to access critical section. debug_sync cannot be used in the current senario because we dont have access to thread pointer in some of the plugin functions. IMHO no test case in the current time frame.
Diffstat (limited to 'sql/sql_plugin.cc')
-rw-r--r--sql/sql_plugin.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 47827e0e567..14668125599 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -1900,7 +1900,8 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name)
mysql_audit_acquire_plugins(thd, MYSQL_AUDIT_GENERAL_CLASS);
mysql_mutex_lock(&LOCK_plugin);
- if (!(plugin= plugin_find_internal(name, MYSQL_ANY_PLUGIN)))
+ if (!(plugin= plugin_find_internal(name, MYSQL_ANY_PLUGIN)) ||
+ plugin->state & (PLUGIN_IS_UNINITIALIZED | PLUGIN_IS_DYING))
{
my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "PLUGIN", name->str);
goto err;