[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<MEYP282MB316491A32BE6F870B093540FBF4B2@MEYP282MB3164.AUSP282.PROD.OUTLOOK.COM>
Date: Tue, 29 Oct 2024 09:56:58 +0000
From: Ryder Wang <rydercoding@...mail.com>
To: Zhihao Cheng <chengzhihao1@...wei.com>, Waqar Hameed
<waqar.hameed@...s.com>, Richard Weinberger <richard@....at>, Sascha Hauer
<s.hauer@...gutronix.de>
CC: "kernel@...s.com" <kernel@...s.com>, "linux-mtd@...ts.infradead.org"
<linux-mtd@...ts.infradead.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH RFC] ubifs: Fix use-after-free in ubifs_tnc_end_commit
> Thanks for reporting that :-). I noticed it a period time ago too, and I
> found 'c->znext', 'c->cnext' and 'znode->cnext' won't be accessed (in
> write mode) by other tasks, because there is only one function
> do_commit() modifying them and do_commit() can be executed by at most
> one task in any time.
It looks the race condition can really happen in this case from the issue reporter.
1. do_commit (ubifs_bg_thread): it can finally touch unprotected znode while calling the function write_index().
2. ubifs_evict_inode (other kernel thread than ubifs_bg_thread): it can finally touch the znode in the function tnc_delete(). Even there is mutex protection for tnc_delete(), but it has no meaning because of do_commit (at the point 1) doesn't have such mutex protection while calling write_index().
Powered by blists - more mailing lists