Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src/sys/miscfs/fdesc Pull up following revision(s) (requested...
details: https://anonhg.NetBSD.org/src/rev/a58975996a2e
branches: netbsd-9
changeset: 1002258:a58975996a2e
user: martin <martin%NetBSD.org@localhost>
date: Mon May 03 09:03:22 2021 +0000
description:
Pull up following revision(s) (requested by hannken in ticket #1267):
sys/miscfs/fdesc/fdesc_vnops.c: revision 1.135
Make sure fdesc_lookup() never returns VNON vnodes.
Should fix PR kern/56130 (fdescfs create nodes with wrong major number)
diffstat:
sys/miscfs/fdesc/fdesc_vnops.c | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
diffs (41 lines):
diff -r e2d903857dc3 -r a58975996a2e sys/miscfs/fdesc/fdesc_vnops.c
--- a/sys/miscfs/fdesc/fdesc_vnops.c Mon May 03 09:01:44 2021 +0000
+++ b/sys/miscfs/fdesc/fdesc_vnops.c Mon May 03 09:03:22 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdesc_vnops.c,v 1.130 2018/09/03 16:29:35 riastradh Exp $ */
+/* $NetBSD: fdesc_vnops.c,v 1.130.4.1 2021/05/03 09:03:22 martin Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdesc_vnops.c,v 1.130 2018/09/03 16:29:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdesc_vnops.c,v 1.130.4.1 2021/05/03 09:03:22 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -295,9 +295,20 @@
good:
KASSERT(ix != -1);
error = vcache_get(dvp->v_mount, &ix, sizeof(ix), vpp);
- if (error == 0 && ix == FD_CTTY)
+ if (error)
+ return error;
+
+ /*
+ * Prevent returning VNON nodes.
+ * Operation fdesc_inactive() will reset the type to VNON.
+ */
+ if (ix == FD_CTTY)
(*vpp)->v_type = VCHR;
- return error;
+ else if (ix >= FD_DESC)
+ (*vpp)->v_type = VREG;
+ KASSERT((*vpp)->v_type != VNON);
+
+ return 0;
}
int
Home |
Main Index |
Thread Index |
Old Index