From ba679ae52f0e9d698c1b36d28a5bc8c233e57a2e Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Thu, 26 Mar 2020 19:19:41 +0400 Subject: [PATCH] Fix for rpl_start_stop_slave failure One may access freed THD members after LOCK_thd_kill is released. With original code it can happen when killing wsrep-disabled thread on a wsrep-enabled server. With 91ab42a8 it is happening on a wsrep-disabled server. --- sql/sql_parse.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 9af4afd4b03..ffba46b4573 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -9086,8 +9086,8 @@ kill_one_thread(THD *thd, longlong id, killed_state kill_signal, killed_type typ else error= (type == KILL_TYPE_QUERY ? ER_KILL_QUERY_DENIED_ERROR : ER_KILL_DENIED_ERROR); - mysql_mutex_unlock(&tmp->LOCK_thd_kill); if (WSREP(tmp)) mysql_mutex_unlock(&tmp->LOCK_thd_data); + mysql_mutex_unlock(&tmp->LOCK_thd_kill); } DBUG_PRINT("exit", ("%d", error)); DBUG_RETURN(error);