summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@google.com>2020-10-09 10:55:30 -0700
committergVisor bot <gvisor-bot@google.com>2020-10-09 10:57:27 -0700
commit76a09f0cf5994bae5684fc80b7e7da6161b52975 (patch)
tree221087732b6c3ebf515298cc3b19cbd82c4e3f97 /pkg
parent8566decab094008d5f873cb679c972d5d60cc49a (diff)
syscalls: Don't leak a file on the error path
Reported-by: syzbot+bb82fb556d5d0a43f632@syzkaller.appspotmail.com PiperOrigin-RevId: 336324720
Diffstat (limited to 'pkg')
-rw-r--r--pkg/sentry/syscalls/linux/sys_file.go1
1 files changed, 1 insertions, 0 deletions
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
}
}