summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorunknown <aelkin/elkin@koti.dsl.inet.fi>2007-09-26 21:59:17 +0200
committerunknown <aelkin/elkin@koti.dsl.inet.fi>2007-09-26 21:59:17 +0200
commit184cddab1328c755e9076028db6ab1deaeed675b (patch)
treef9e142d6f36705dcca9d4ba6c360f67aeefaa45a /sql/sql_parse.cc
parent5418752d5b9c7b79702a7edc5440166495de7851 (diff)
downloadmariadb-git-184cddab1328c755e9076028db6ab1deaeed675b.tar.gz
Bug #26000 SHOW SLAVE STATUS can crash mysqld during shutdown process
active_mi has been reset (shutdown) at the time of quering with SHOW SLAVE STATUS so that at handling of SHOW an attempt to read its members segfaults. Fixed with checking the value of active_mi before to call show_master_info() Merely send_ok() is invoked when active_mi does not exist. A test can not be easiely written. Notice, there are more analogical cases in the code which require a similar treatment (to be reported as a bug separately). sql/sql_parse.cc: Ignore reporting and send only OK if master info struct has been destoyed. As this must be at shutdown merely a warning is sent to the client.
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 58f5ffc5235..075ce2c9e8c 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2844,7 +2844,16 @@ mysql_execute_command(THD *thd)
if (check_global_access(thd, SUPER_ACL | REPL_CLIENT_ACL))
goto error;
pthread_mutex_lock(&LOCK_active_mi);
- res = show_master_info(thd,active_mi);
+ if (active_mi != NULL)
+ {
+ res = show_master_info(thd, active_mi);
+ }
+ else
+ {
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
+ "the master info structure does not exist");
+ send_ok(thd);
+ }
pthread_mutex_unlock(&LOCK_active_mi);
break;
}