Repository navigation
Commit ad56eda
jbd2: fix use after free in jbd2_journal_dirty_metadata()
jbd2_journal_dirty_metadata() didn't get a reference to journal_head it
was working with. This is OK in most of the cases since the journal head
should be attached to a transaction but in rare occasions when we are
journalling data, __ext4_journalled_writepage() can race with
jbd2_journal_invalidatepage() stripping buffers from a page and thus
journal head can be freed under hands of jbd2_journal_dirty_metadata().
Fix the problem by getting own journal head reference in
jbd2_journal_dirty_metadata() (and also in jbd2_journal_set_triggers()
which can possibly have the same issue).
Reported-by: Zheng Liu <gnehzuil.liu@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: stable@vger.kernel.org1 parent 386ad67 commit ad56eda
1 file changed
Lines changed: 10 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1065 | 1065 | | |
1066 | 1066 | | |
1067 | 1067 | | |
1068 | | - | |
| 1068 | + | |
1069 | 1069 | | |
| 1070 | + | |
| 1071 | + | |
1070 | 1072 | | |
| 1073 | + | |
1071 | 1074 | | |
1072 | 1075 | | |
1073 | 1076 | | |
| |||
1119 | 1122 | | |
1120 | 1123 | | |
1121 | 1124 | | |
1122 | | - | |
| 1125 | + | |
1123 | 1126 | | |
1124 | 1127 | | |
1125 | | - | |
1126 | | - | |
1127 | 1128 | | |
1128 | 1129 | | |
1129 | | - | |
| 1130 | + | |
| 1131 | + | |
1130 | 1132 | | |
1131 | 1133 | | |
1132 | 1134 | | |
| 1135 | + | |
| 1136 | + | |
1133 | 1137 | | |
1134 | 1138 | | |
1135 | 1139 | | |
| |||
1220 | 1224 | | |
1221 | 1225 | | |
1222 | 1226 | | |
| 1227 | + | |
1223 | 1228 | | |
1224 | 1229 | | |
1225 | 1230 | | |
| |||
0 commit comments