From 74f61caed59f2e944750480b011df7bc67fded13 Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Fri, 10 Jul 2020 09:24:27 +0000 Subject: [PATCH] vfs: fix early termination of kern_getfsstat The kernel would unlock already unlocked mutex if the buffer got filled up before the mount list ended. Reported by: pho Fixes: r363069 ("vfs: depessimize getfsstat when only the count is requested") --- sys/kern/vfs_syscalls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index f37a54809e24..2caf09f3412c 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -551,7 +551,7 @@ kern_getfsstat(struct thread *td, struct statfs **buf, size_t bufsize, if (count == maxcount) { vfs_unbusy(mp); - break; + goto out; } mtx_lock(&mountlist_mtx);