syscalls: Don't leak a file on the error path

Reported-by: syzbot+bb82fb556d5d0a43f632@syzkaller.appspotmail.com
PiperOrigin-RevId: 336324720
This commit is contained in:
Andrei Vagin
2020-10-09 10:57:27 -07:00
committed by gVisor bot
parent 8566decab0
commit 76a09f0cf5
+1
View File
@@ -84,6 +84,7 @@ func fileOpOn(t *kernel.Task, dirFD int32, path string, resolve bool, fn func(ro
}
rel = f.Dirent
if !fs.IsDir(rel.Inode.StableAttr) {
f.DecRef(t)
return syserror.ENOTDIR
}
}