History

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.

Chengguang Xu committed 7 years ago

Commit 0d521541 parent 592acbf4 files · +61 −36Browse files

Showing the changes to include/linux (1 of 4 files). Show all

Unified · Split

include/linux/jbd2.h+5−3
@@ -1318,7 +1318,7 @@ extern void __wait_on_journal (journal_t *); · 1317 unmodified lines
13181318
13191319 /* Transaction cache support */
13201320 extern void jbd2_journal_destroy_transaction_cache(void);
1321−extern int jbd2_journal_init_transaction_cache(void);
1321+extern int __init jbd2_journal_init_transaction_cache(void);
13221322 extern void jbd2_journal_free_transaction(transaction_t *);
13231323
13241324 /*
@@ -1446,8 +1446,10 @@ static inline void jbd2_free_inode(struct jbd2_inode *jinode) · 121 unmodified lines
14461446 /* Primary revoke support */
14471447 #define JOURNAL_REVOKE_DEFAULT_HASH 256
14481448 extern int jbd2_journal_init_revoke(journal_t *, int);
1449−extern void jbd2_journal_destroy_revoke_caches(void);
1450−extern int jbd2_journal_init_revoke_caches(void);
1449+extern void jbd2_journal_destroy_revoke_record_cache(void);
1450+extern void jbd2_journal_destroy_revoke_table_cache(void);
1451+extern int __init jbd2_journal_init_revoke_record_cache(void);
1452+extern int __init jbd2_journal_init_revoke_table_cache(void);
14511453
14521454 extern void jbd2_journal_destroy_revoke(journal_t *);
14531455 extern int jbd2_journal_revoke (handle_t *, unsigned long long, struct buffer_head *);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t