[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<MEYP282MB316412B08A32373E5ED9B896BF4B2@MEYP282MB3164.AUSP282.PROD.OUTLOOK.COM>
Date: Tue, 29 Oct 2024 08:10:50 +0000
From: Ryder Wang <rydercoding@...mail.com>
To: Waqar Hameed <waqar.hameed@...s.com>, Richard Weinberger <richard@....at>,
Zhihao Cheng <chengzhihao1@...wei.com>, 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
I just have some interesting finding.
The code of the function write_index() has a race condition bug. c->enext is used in write_index(), but it is NOT protected by c->tnc_mutex. So there must be SOME race condition problem. I believe some znode may be corrupted or misread if 2 kernel tasks are operating the same znode concurrently.
The code comment of struct ubifs_info below indicates that c->enext must be protected by c->tnc_mutex.
--------------------------------------------------------------------------------------------------
* @tnc_mutex: protects the Tree Node Cache (TNC), @zroot, @cnext, @enext, and
* @calc_idx_sz
--------------------------------------------------------------------------------------------------
That's why I don't think this patch can fully fix this issue because the race condition is still there.
Powered by blists - more mailing lists