Module Name:    src
Committed By:   hannken
Date:           Mon Nov 21 10:37:14 UTC 2022

Modified Files:
        src/sys/fs/union: union_vfsops.c

Log Message:
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+ecda308a1dd965283...@syzkaller.appspotmail.com
Reported-by: syzbot+9b687847ee5f43e94...@syzkaller.appspotmail.com
Reported-by: syzbot+9f9d1a841734f9f50...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/fs/union/union_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/fs/union/union_vfsops.c
diff -u src/sys/fs/union/union_vfsops.c:1.84 src/sys/fs/union/union_vfsops.c:1.85
--- src/sys/fs/union/union_vfsops.c:1.84	Fri Nov  4 11:20:39 2022
+++ src/sys/fs/union/union_vfsops.c	Mon Nov 21 10:37:14 2022
@@ -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
 	 * 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;

Reply via email to