Re: [syzbot] [ext4?] [overlayfs?] WARNING in file_seek_cur_needs_f_lock

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

 



On Mon, 7 Apr 2025 at 05:57, syzbot
<syzbot+4036165fc595a74b09b2@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit:    16cd1c265776 Merge tag 'timers-cleanups-2025-04-06' of git..
> git tree:       upstream
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=12e7923f980000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=c79406130aa88d22
> dashboard link: https://syzkaller.appspot.com/bug?extid=4036165fc595a74b09b2
> compiler:       gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=14f9bd98580000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1571c7e4580000


#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
v6.15-rc1
diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c
index 969b458100fe..548f0e6aed54 100644
--- a/fs/overlayfs/file.c
+++ b/fs/overlayfs/file.c
@@ -273,6 +273,12 @@ static loff_t ovl_llseek(struct file *file, loff_t offset, int whence)
 	ovl_inode_lock(inode);
 	realfile->f_pos = file->f_pos;
 
+	/* Prevent WARNING in file_seek_cur_needs_f_lock() */
+	if (whence == SEEK_CUR && offset) {
+		offset += file->f_pos;
+		whence = SEEK_SET;
+	}
+
 	old_cred = ovl_override_creds(inode->i_sb);
 	ret = vfs_llseek(realfile, offset, whence);
 	ovl_revert_creds(old_cred);

[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux