lkml.org 
[lkml]   [2023]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] nilfs2: fix use-after-free bug of nilfs_root in nilfs_evict_inode()
On Wed, 10 May 2023 00:29:56 +0900 Ryusuke Konishi <konishi.ryusuke@gmail.com> wrote:

> During unmount process of nilfs2, nothing holds nilfs_root structure after
> nilfs2 detaches its writer in nilfs_detach_log_writer(). However, since
> nilfs_evict_inode() uses nilfs_root for some cleanup operations, it may
> cause use-after-free read if inodes are left in "garbage_list" and
> released by nilfs_dispose_list() at the end of nilfs_detach_log_writer().
>
> Fix this issue by modifying nilfs_evict_inode() to only clear inode
> without additional metadata changes that use nilfs_root if the file system
> is degraded to read-only or the writer is detached.
>
> ...
>
> --- a/fs/nilfs2/inode.c
> +++ b/fs/nilfs2/inode.c
> @@ -917,6 +917,7 @@ void nilfs_evict_inode(struct inode *inode)
> struct nilfs_transaction_info ti;
> struct super_block *sb = inode->i_sb;
> struct nilfs_inode_info *ii = NILFS_I(inode);
> + struct the_nilfs *nilfs;
> int ret;

`the_nilfs' is unused - I'll zap it.


\
 
 \ /
  Last update: 2023-05-13 01:45    [W:0.066 / U:0.392 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site