From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D3D6241AAB; Tue, 16 Jan 2024 00:26:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Dg7gpeOZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC265C433F1; Tue, 16 Jan 2024 00:26:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705364777; bh=oMvl1NuqU/n3L8dT/FcVFvm6PLo9rE5CZ7rnIe1yzbk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dg7gpeOZJzpoNqDxJp1rhaA2OQtZcEBUCLpNMno1zXUdi+ctnR5LOoRLENZ8AcPa/ 5/6LhZu/xD1qnFUJE7EfvazSB2vtJzuLYbu0J9Sd+IRUVrcyS+5Z/IRWAKuHUvHVvC rz1kEBwJk4qvlpGbQMUhV+gvYkWbqcwAzrFFcnv7RIDCNUWIiLAgH4Qu+M2GyNvOd+ 30Fjcc4XKAl7vQqENEG4Y0jaj6f883UDEjKI5PqZXtIKCpQPBG4DJwbrjl5JoH3oMa 52mDAquJu9sCgNd/C9muTfpCzXsZHYFn+3k8h/ZVKNlBO/pH2qbz4GRUX2drRCe+Qb ot6fbX3B3KG2A== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Edward Adam Davis , syzbot+01cf2dbcbe2022454388@syzkaller.appspotmail.com, Dave Kleikamp , Sasha Levin , shaggy@kernel.org, brauner@kernel.org, jack@suse.cz, jfs-discussion@lists.sourceforge.net Subject: [PATCH AUTOSEL 5.15 05/13] jfs: fix uaf in jfs_evict_inode Date: Mon, 15 Jan 2024 19:25:41 -0500 Message-ID: <20240116002603.215942-5-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116002603.215942-1-sashal@kernel.org> References: <20240116002603.215942-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 5.15.147 Content-Transfer-Encoding: 8bit From: Edward Adam Davis [ Upstream commit e0e1958f4c365e380b17ccb35617345b31ef7bf3 ] When the execution of diMount(ipimap) fails, the object ipimap that has been released may be accessed in diFreeSpecial(). Asynchronous ipimap release occurs when rcu_core() calls jfs_free_node(). Therefore, when diMount(ipimap) fails, sbi->ipimap should not be initialized as ipimap. Reported-and-tested-by: syzbot+01cf2dbcbe2022454388@syzkaller.appspotmail.com Signed-off-by: Edward Adam Davis Signed-off-by: Dave Kleikamp Signed-off-by: Sasha Levin --- fs/jfs/jfs_mount.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/jfs/jfs_mount.c b/fs/jfs/jfs_mount.c index aa4ff7bcaff2..55702b31ab3c 100644 --- a/fs/jfs/jfs_mount.c +++ b/fs/jfs/jfs_mount.c @@ -172,15 +172,15 @@ int jfs_mount(struct super_block *sb) } jfs_info("jfs_mount: ipimap:0x%p", ipimap); - /* map further access of per fileset inodes by the fileset inode */ - sbi->ipimap = ipimap; - /* initialize fileset inode allocation map */ if ((rc = diMount(ipimap))) { jfs_err("jfs_mount: diMount failed w/rc = %d", rc); goto err_ipimap; } + /* map further access of per fileset inodes by the fileset inode */ + sbi->ipimap = ipimap; + return rc; /* -- 2.43.0