From 76a09f0cf5994bae5684fc80b7e7da6161b52975 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Fri, 9 Oct 2020 10:55:30 -0700 Subject: syscalls: Don't leak a file on the error path Reported-by: syzbot+bb82fb556d5d0a43f632@syzkaller.appspotmail.com PiperOrigin-RevId: 336324720 --- pkg/sentry/syscalls/linux/sys_file.go | 1 + 1 file changed, 1 insertion(+) (limited to 'pkg') diff --git a/pkg/sentry/syscalls/linux/sys_file.go b/pkg/sentry/syscalls/linux/sys_file.go index 98331eb3c..519066a47 100644 --- a/pkg/sentry/syscalls/linux/sys_file.go +++ b/pkg/sentry/syscalls/linux/sys_file.go @@ -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 } } -- cgit v1.2.3