summaryrefslogtreecommitdiff
path: root/sys/fs
diff options
context:
space:
mode:
authorhannken <hannken@NetBSD.org>2022-11-21 10:37:14 +0000
committerhannken <hannken@NetBSD.org>2022-11-21 10:37:14 +0000
commitfefafd42995a195c794d87c5343e2feb3008b9d0 (patch)
tree1ae2230236d8b0eb85052478fa25345ee7d259ba /sys/fs
parent7c57a7e409a7470a8b1ea8c91ea5633bc35be29c (diff)
When testing whiteout support on the underlying file system
union_mount() should not use a NULL componentname as not all file systems can handle it. Use static { LOOKUP, NOCRED } componentname instead. Reported-by: syzbot+ecda308a1dd9652836d0@syzkaller.appspotmail.com Reported-by: syzbot+9b687847ee5f43e94ca3@syzkaller.appspotmail.com Reported-by: syzbot+9f9d1a841734f9f50de2@syzkaller.appspotmail.com
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/union/union_vfsops.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/fs/union/union_vfsops.c b/sys/fs/union/union_vfsops.c
index 49b3dd4a8a7..3a5068efd47 100644
--- a/sys/fs/union/union_vfsops.c
+++ b/sys/fs/union/union_vfsops.c
@@ -1,4 +1,4 @@
-/* $NetBSD: union_vfsops.c,v 1.84 2022/11/04 11:20:39 hannken Exp $ */
+/* $NetBSD: union_vfsops.c,v 1.85 2022/11/21 10:37:14 hannken Exp $ */
/*
* Copyright (c) 1994 The Regents of the University of California.
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.84 2022/11/04 11:20:39 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.85 2022/11/21 10:37:14 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -205,9 +205,13 @@ union_mount(struct mount *mp, const char *path, void *data, size_t *data_len)
* supports whiteout operations
*/
if ((mp->mnt_flag & MNT_RDONLY) == 0) {
+ static struct componentname nullcn = {
+ .cn_nameiop = LOOKUP,
+ .cn_cred = NOCRED
+ };
+
vn_lock(um->um_uppervp, LK_EXCLUSIVE | LK_RETRY);
- error = VOP_WHITEOUT(um->um_uppervp,
- (struct componentname *) 0, LOOKUP);
+ error = VOP_WHITEOUT(um->um_uppervp, &nullcn, LOOKUP);
VOP_UNLOCK(um->um_uppervp);
if (error)
goto bad;