git: 59fb30e78554 - stable/13 - getmntpoint: Don't compare st_rdev for non-devices
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 27 Aug 2025 19:22:15 UTC
The branch stable/13 has been updated by des:
URL: https://cgit.FreeBSD.org/src/commit/?id=59fb30e78554a587a0954351cc7a682b4e24ecdb
commit 59fb30e78554a587a0954351cc7a682b4e24ecdb
Author: Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2025-08-17 17:07:45 +0000
Commit: Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2025-08-27 18:50:57 +0000
getmntpoint: Don't compare st_rdev for non-devices
If the mntfromname of a mountpoint is not a device (e.g. nullfs, tarfs,
procfs) we shouldn't compare st_rdev, as any match will be spurious.
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D51945
(cherry picked from commit 8073a5137f223bb481606b15edaa5ecb93ceffcb)
---
sbin/mount/getmntopts.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sbin/mount/getmntopts.c b/sbin/mount/getmntopts.c
index 31987f7b0b78..fab25466425f 100644
--- a/sbin/mount/getmntopts.c
+++ b/sbin/mount/getmntopts.c
@@ -192,6 +192,7 @@ getmntpoint(const char *name)
strncpy(statfsp->f_mntfromname, device, len);
}
if (stat(ddevname, &mntdevstat) == 0 &&
+ S_ISCHR(mntdevstat.st_mode) &&
mntdevstat.st_rdev == devstat.st_rdev)
return (statfsp);
}