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] [day] [month] [year] [list]
Message-ID: <20240925070530.cddj4cs4ia7qy6qm@quack3>
Date: Wed, 25 Sep 2024 09:05:30 +0200
From: Jan Kara <jack@...e.cz>
To: Zhao Mengmeng <zhaomzhao@....com>
Cc: Jan Kara <jack@...e.cz>, jack@...e.com, zhaomengmeng@...inos.cn,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] udf: refactor udf_next_aext() to handle error

On Tue 24-09-24 20:08:56, Zhao Mengmeng wrote:
> On 2024/9/20 23:47, Jan Kara wrote:
> > On Wed 18-09-24 17:36:33, Zhao Mengmeng wrote:
> >> diff --git a/fs/udf/truncate.c b/fs/udf/truncate.c
> >> index 91b6e2698e7e..b7361222f988 100644
> >> --- a/fs/udf/truncate.c
> >> +++ b/fs/udf/truncate.c
> >> @@ -85,7 +85,7 @@ void udf_truncate_tail_extent(struct inode *inode)
> >>  		BUG();
> >>  
> >>  	/* Find the last extent in the file */
> >> -	while ((netype = udf_next_aext(inode, &epos, &eloc, &elen, 1)) != -1) {
> >> +	while (!udf_next_aext(inode, &epos, &eloc, &elen, &netype, 1)) {
> >>  		etype = netype;
> >>  		lbcount += elen;
> >>  		if (lbcount > inode->i_size) {
> > 
> > This should be checking for error (after the loop) so that we don't
> > accidentally try to truncate extents early in case of error.
> > 
> Sorry to bother, in case of error(including EOF), it won't go into the loop and
> has chance to call extent_trunc(). After the loop, only some update and clean op,
> 
> 	iinfo->i_lenExtents = inode->i_size;
> 	brelse(epos.bh);
> 
> So I'm a little confused which part of this piece of code needs to change?

So if we are not able to scan until EOF due to error, we should set
i_lenExtents to i_size but you're right this is mostly a cosmetic thing.

								Honza
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ