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..