[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_7F29369E974036964A3E742F778567CC3C09@qq.com>
Date: Wed, 31 Jan 2024 20:04:27 +0800
From: Edward Adam Davis <eadavis@...com>
To: syzbot+cdee56dbcdf0096ef605@...kaller.appspotmail.com
Cc: adilger.kernel@...ger.ca,
chandan.babu@...cle.com,
jack@...e.com,
linux-ext4@...r.kernel.org,
linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-xfs@...r.kernel.org,
syzkaller-bugs@...glegroups.com,
tytso@....edu
Subject: [PATCH] jbd2: user-memory-access in jbd2__journal_start
Before reusing the handle, it is necessary to confirm that the transaction is
ready.
Reported-and-tested-by: syzbot+cdee56dbcdf0096ef605@...kaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@...com>
---
fs/jbd2/transaction.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index cb0b8d6fc0c6..702312cd5392 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -493,6 +493,9 @@ handle_t *jbd2__journal_start(journal_t *journal, int nblocks, int rsv_blocks,
return ERR_PTR(-EROFS);
if (handle) {
+ if (handle->saved_alloc_context & ~PF_MEMALLOC_NOFS)
+ return ERR_PTR(-EBUSY);
+
J_ASSERT(handle->h_transaction->t_journal == journal);
handle->h_ref++;
return handle;
--
2.43.0
Powered by blists - more mailing lists