jbd2: fix potential double free

When failing from creating cache jbd2_inode_cache, we will destroy the
previously created cache jbd2_handle_cache twice.  This patch fixes
this by moving each cache initialization/destruction to its own
separate, individual function.

Signed-off-by: Chengguang Xu <cgxu519@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org
This commit is contained in:
Chengguang Xu
2019-05-10 21:15:47 -04:00
committed by Theodore Ts'o
부모 592acbf168
커밋 0d52154bb0
4개의 변경된 파일63개의 추가작업 그리고 38개의 파일을 삭제

파일 보기

@@ -42,9 +42,11 @@ int __init jbd2_journal_init_transaction_cache(void)
0,
SLAB_HWCACHE_ALIGN|SLAB_TEMPORARY,
NULL);
if (transaction_cache)
return 0;
return -ENOMEM;
if (!transaction_cache) {
pr_emerg("JBD2: failed to create transaction cache\n");
return -ENOMEM;
}
return 0;
}
void jbd2_journal_destroy_transaction_cache(void)