diff options
author | Jan Lindström <jan.lindstrom@mariadb.com> | 2015-09-04 20:09:20 +0300 |
---|---|---|
committer | Jan Lindström <jan.lindstrom@mariadb.com> | 2015-09-04 20:19:45 +0300 |
commit | e04723d754ffff6c532190205d0f3a5a7033b310 (patch) | |
tree | 5bc66984d0a1d1eeedc41606c65dce77e371d962 /storage/innobase | |
parent | 7e916bb86f512ff79f30d809b813608a625ec5ba (diff) | |
download | mariadb-git-e04723d754ffff6c532190205d0f3a5a7033b310.tar.gz |
MDEV-8750: Server crashes in page_cur_is_after_last on altering table using a wrong encryption key
Analysis: Server tried to continue reading tablespace using a cursor after
we had resolved that pages in the tablespace can't be decrypted.
Fixed by addind check is tablespace still encrypted.
Diffstat (limited to 'storage/innobase')
-rw-r--r-- | storage/innobase/handler/handler0alter.cc | 4 | ||||
-rw-r--r-- | storage/innobase/row/row0merge.cc | 18 |
2 files changed, 22 insertions, 0 deletions
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 316cbc75a8b..3ed0067f395 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -4179,6 +4179,10 @@ oom: : ha_alter_info->key_info_buffer[ prebuilt->trx->error_key_num].name); break; + case DB_ENCRYPTED_DECRYPT_FAILED: + my_error(ER_NO_SUCH_TABLE_IN_ENGINE, MYF(0), + table_share->db.str, table_share->table_name.str); + break; default: my_error_innodb(error, table_share->table_name.str, diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index c1d3e08beaa..ab2ea05b2f2 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -1431,6 +1431,13 @@ row_merge_read_clustered_index( row_ext_t* ext; page_cur_t* cur = btr_pcur_get_page_cur(&pcur); + /* Do not continue if table pages are still encrypted */ + if (old_table->is_encrypted || new_table->is_encrypted) { + err = DB_ENCRYPTED_DECRYPT_FAILED; + trx->error_key_num = 0; + goto func_exit; + } + page_cur_move_to_next(cur); if (page_cur_is_after_last(cur)) { @@ -3754,6 +3761,17 @@ row_merge_build_indexes( pct_cost = COST_READ_CLUSTERED_INDEX * 100 / (total_static_cost + total_dynamic_cost); + /* Do not continue if we can't encrypt table pages */ + if (old_table->is_encrypted || new_table->is_encrypted) { + error = DB_ENCRYPTED_DECRYPT_FAILED; + ib_push_warning(trx->mysql_thd, DB_ENCRYPTED_DECRYPT_FAILED, + "Table %s is encrypted but encryption service or" + " used key_id is not available. " + " Can't continue reading table.", + old_table->is_encrypted ? old_table->name : new_table->name); + goto func_exit; + } + /* Read clustered index of the table and create files for secondary index entries for merge sort */ |