Skip to content

Commit bbb3fb3

Browse files
committed
Follow-up for MDEV-11630 Call mutex_free() before freeing the mutex list
fil_tablespace_iterate(): Call fil_space_destroy_crypt_data() to invoke mutex_free() for the mutex_create() that was done in fil_space_read_crypt_data(). Also, remember to free iter.crypt_io_buffer. The failure to call mutex_free() would cause sync_latch_meta_destroy() to access freed memory on shutdown. This affected the IMPORT of encrypted tablespaces.
1 parent 08f79bd commit bbb3fb3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

storage/innobase/fil/fil0fil.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6685,18 +6685,18 @@ fil_tablespace_iterate(
66856685
iter.io_buffer = static_cast<byte*>(
66866686
ut_align(io_buffer, UNIV_PAGE_SIZE));
66876687

6688-
/** Add an exta buffer for encryption */
6689-
void* crypt_io_buffer = NULL;
6690-
if (iter.crypt_data != NULL) {
6691-
crypt_io_buffer = ut_malloc_nokey(
6692-
iter.n_io_buffers * UNIV_PAGE_SIZE);
6693-
iter.crypt_io_buffer = static_cast<byte*>(
6694-
crypt_io_buffer);
6695-
}
6688+
iter.crypt_io_buffer = iter.crypt_data
6689+
? static_cast<byte*>(
6690+
ut_malloc_nokey(iter.n_io_buffers
6691+
* UNIV_PAGE_SIZE))
6692+
: NULL;
66966693

66976694
err = fil_iterate(iter, block, callback);
66986695

66996696
ut_free(io_buffer);
6697+
ut_free(iter.crypt_io_buffer);
6698+
6699+
fil_space_destroy_crypt_data(&iter.crypt_data);
67006700
}
67016701
}
67026702

0 commit comments

Comments
 (0)