Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Jan 2021 02:50:01 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 9f200bc47b5d - main - tmpfs_free_tmp(): explicitly assert that tmp is locked
Message-ID:  <202101100250.10A2o1jh060355@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=9f200bc47b5d8445d91d51f6dfd6af0f1fbbe354

commit 9f200bc47b5d8445d91d51f6dfd6af0f1fbbe354
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-01-05 18:53:45 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2021-01-10 02:48:29 +0000

    tmpfs_free_tmp(): explicitly assert that tmp is locked
    
    Despite TMPFS_UNLOCK() is done in both paths later, unlocking not locked
    mutex provides different failure mode.
    
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
---
 sys/fs/tmpfs/tmpfs_vfsops.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c
index 125c5bb64120..ba7c654d4f0a 100644
--- a/sys/fs/tmpfs/tmpfs_vfsops.c
+++ b/sys/fs/tmpfs/tmpfs_vfsops.c
@@ -544,8 +544,9 @@ tmpfs_unmount(struct mount *mp, int mntflags)
 void
 tmpfs_free_tmp(struct tmpfs_mount *tmp)
 {
-
+	TMPFS_MP_ASSERT_LOCKED(tmp);
 	MPASS(tmp->tm_refcount > 0);
+
 	tmp->tm_refcount--;
 	if (tmp->tm_refcount > 0) {
 		TMPFS_UNLOCK(tmp);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101100250.10A2o1jh060355>