Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Add missing access check for REMOVE into zfs_netbsd_lookup().



details:   https://anonhg.NetBSD.org/src/rev/5674bdfe0814
branches:  trunk
changeset: 446234:5674bdfe0814
user:      hannken <hannken%NetBSD.org@localhost>
date:      Wed Nov 28 09:58:58 2018 +0000

description:
Add missing access check for REMOVE into zfs_netbsd_lookup().

PR kern/47656 test zfs_dirperms.

diffstat:

 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c |  9 ++++++++-
 tests/fs/vfs/t_unpriv.c                                |  4 +---
 2 files changed, 9 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r b77c2c42a684 -r 5674bdfe0814 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c    Wed Nov 28 09:57:59 2018 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c    Wed Nov 28 09:58:58 2018 +0000
@@ -5128,8 +5128,15 @@
                                error = EJUSTRETURN;
                                break;
                        }
-                       /* FALLTHROUGH */
+                       break;
                case DELETE:
+                       if (error == 0) {
+                               error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred);
+                               if (error) {
+                                       VN_RELE(*vpp);
+                                       *vpp = NULL;
+                               }
+                       }
                        break;
                }
        }
diff -r b77c2c42a684 -r 5674bdfe0814 tests/fs/vfs/t_unpriv.c
--- a/tests/fs/vfs/t_unpriv.c   Wed Nov 28 09:57:59 2018 +0000
+++ b/tests/fs/vfs/t_unpriv.c   Wed Nov 28 09:58:58 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_unpriv.c,v 1.14 2018/11/28 09:57:59 hannken Exp $    */
+/*     $NetBSD: t_unpriv.c,v 1.15 2018/11/28 09:58:58 hannken Exp $    */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -94,8 +94,6 @@
        rump_pub_lwproc_rfork(RUMP_RFCFDG);
        if (rump_sys_setuid(1) == -1)
                atf_tc_fail_errno("setuid");
-       if (FSTYPE_ZFS(tc))
-               atf_tc_expect_fail("PR kern/47656: Test known to be broken");
         if (rump_sys_open(name, O_RDWR|O_CREAT, 0666) != -1 || errno != EACCES)
                atf_tc_fail_errno("open");
        rump_pub_lwproc_releaselwp();



Home | Main Index | Thread Index | Old Index