git: 6de3cf14c47d - main - vn_open_cred(): disallow O_CREAT | O_EMPTY_PATH
Konstantin Belousov
kib at FreeBSD.org
Wed May 12 23:32:25 UTC 2021
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=6de3cf14c47d97b423ae25d5bd1d80b896ecd9e6
commit 6de3cf14c47d97b423ae25d5bd1d80b896ecd9e6
Author: Konstantin Belousov <kib at FreeBSD.org>
AuthorDate: 2021-05-12 19:04:44 +0000
Commit: Konstantin Belousov <kib at FreeBSD.org>
CommitDate: 2021-05-12 23:32:04 +0000
vn_open_cred(): disallow O_CREAT | O_EMPTY_PATH
This combination does not make sense, and cannot be satisfied by lookup.
In particular, lookup cannot supply dvp, it only can directly return vp.
Reported and reviewed by: markj using syzkaller
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
---
sys/kern/vfs_vnops.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index 670bc4bf8fcc..8f583329f067 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -233,7 +233,8 @@ restart:
first_open = false;
fmode = *flagp;
if ((fmode & (O_CREAT | O_EXCL | O_DIRECTORY)) == (O_CREAT |
- O_EXCL | O_DIRECTORY))
+ O_EXCL | O_DIRECTORY) ||
+ (fmode & (O_CREAT | O_EMPTY_PATH)) == (O_CREAT | O_EMPTY_PATH))
return (EINVAL);
else if ((fmode & (O_CREAT | O_DIRECTORY)) == O_CREAT) {
ndp->ni_cnd.cn_nameiop = CREATE;
More information about the dev-commits-src-main
mailing list