lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 26 Jul 2019 17:38:10 +0800
From:   Joseph Qi <joseph.qi@...ux.alibaba.com>
To:     Jia-Ju Bai <baijiaju1990@...il.com>, mark@...heh.com,
        jlbec@...lplan.org
Cc:     ocfs2-devel@....oracle.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] fs: ocfs2: Fix a possible null-pointer dereference in
 ocfs2_write_end_nolock()



On 19/7/26 11:37, Jia-Ju Bai wrote:
> In ocfs2_write_end_nolock(), there are an if statement on lines 1976, 
> 2047 and 2058, to check whether handle is NULL:
>     if (handle)
> 
> When handle is NULL, it is used on line 2045:
> 	ocfs2_update_inode_fsync_trans(handle, inode, 1);
>         oi->i_sync_tid = handle->h_transaction->t_tid;
> 
> Thus, a possible null-pointer dereference may occur.
> 
> To fix this bug, handle is checked before calling
> ocfs2_update_inode_fsync_trans().
> 
> This bug is found by a static analysis tool STCheck written by us.
> 
> Signed-off-by: Jia-Ju Bai <baijiaju1990@...il.com>

Looks good.
Reviewed-by: Joseph Qi <joseph.qi@...ux.alibaba.com>

> ---
>  fs/ocfs2/aops.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
> index a4c905d6b575..5473bd99043e 100644
> --- a/fs/ocfs2/aops.c
> +++ b/fs/ocfs2/aops.c
> @@ -2042,7 +2042,8 @@ int ocfs2_write_end_nolock(struct address_space *mapping,
>  		inode->i_mtime = inode->i_ctime = current_time(inode);
>  		di->i_mtime = di->i_ctime = cpu_to_le64(inode->i_mtime.tv_sec);
>  		di->i_mtime_nsec = di->i_ctime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec);
> -		ocfs2_update_inode_fsync_trans(handle, inode, 1);
> +		if (handle)
> +			ocfs2_update_inode_fsync_trans(handle, inode, 1);
>  	}
>  	if (handle)
>  		ocfs2_journal_dirty(handle, wc->w_di_bh);
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ