]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.8.5/jbd2-fix-incorrect-unlock-on-j_list_lock.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.8.5 / jbd2-fix-incorrect-unlock-on-j_list_lock.patch
CommitLineData
4f0a39a2
GKH
1From 559cce698eaf4ccecb2213b2519ea3a0413e5155 Mon Sep 17 00:00:00 2001
2From: Taesoo Kim <tsgatesv@gmail.com>
3Date: Wed, 12 Oct 2016 23:19:18 -0400
4Subject: jbd2: fix incorrect unlock on j_list_lock
5
6From: Taesoo Kim <tsgatesv@gmail.com>
7
8commit 559cce698eaf4ccecb2213b2519ea3a0413e5155 upstream.
9
10When 'jh->b_transaction == transaction' (asserted by below)
11
12 J_ASSERT_JH(jh, (jh->b_transaction == transaction || ...
13
14'journal->j_list_lock' will be incorrectly unlocked, since
15the the lock is aquired only at the end of if / else-if
16statements (missing the else case).
17
18Signed-off-by: Taesoo Kim <tsgatesv@gmail.com>
19Signed-off-by: Theodore Ts'o <tytso@mit.edu>
20Reviewed-by: Andreas Dilger <adilger@dilger.ca>
21Fixes: 6e4862a5bb9d12be87e4ea5d9a60836ebed71d28
22Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
23
24---
25 fs/jbd2/transaction.c | 3 ++-
26 1 file changed, 2 insertions(+), 1 deletion(-)
27
28--- a/fs/jbd2/transaction.c
29+++ b/fs/jbd2/transaction.c
30@@ -1149,6 +1149,7 @@ int jbd2_journal_get_create_access(handl
31 JBUFFER_TRACE(jh, "file as BJ_Reserved");
32 spin_lock(&journal->j_list_lock);
33 __jbd2_journal_file_buffer(jh, transaction, BJ_Reserved);
34+ spin_unlock(&journal->j_list_lock);
35 } else if (jh->b_transaction == journal->j_committing_transaction) {
36 /* first access by this transaction */
37 jh->b_modified = 0;
38@@ -1156,8 +1157,8 @@ int jbd2_journal_get_create_access(handl
39 JBUFFER_TRACE(jh, "set next transaction");
40 spin_lock(&journal->j_list_lock);
41 jh->b_next_transaction = transaction;
42+ spin_unlock(&journal->j_list_lock);
43 }
44- spin_unlock(&journal->j_list_lock);
45 jbd_unlock_bh_state(bh);
46
47 /*