Re: [PATCH v7 1/2] Add do_ftruncate that truncates a struct file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 26, 2024 at 05:57:19PM +0200, Tony Solomonik wrote:
>  	f = fdget(fd);
>  	if (!f.file)
> -		goto out;
> +		return -EBADF;
>  
>  	/* explicitly opened as large or we are on 64-bit box */
>  	if (f.file->f_flags & O_LARGEFILE)
>  		small = 0;
>  
> -	dentry = f.file->f_path.dentry;
> -	inode = dentry->d_inode;
> -	error = -EINVAL;
> -	if (!S_ISREG(inode->i_mode) || !(f.file->f_mode & FMODE_WRITE))
> -		goto out_putf;
> -
> -	error = -EINVAL;
>  	/* Cannot ftruncate over 2^31 bytes without large file support */
>  	if (small && length > MAX_NON_LFS)
> -		goto out_putf;
> +		return -EINVAL;

I think this is wrong -- you need to putf after this point..





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux