Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/compat/netbsd32 Pull up following revision(s) (reques...



details:   https://anonhg.NetBSD.org/src/rev/2fea18a42462
branches:  netbsd-9
changeset: 374109:2fea18a42462
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Apr 01 15:51:16 2023 +0000

description:
Pull up following revision(s) (requested by riastradh in ticket #1620):

        sys/compat/netbsd32/netbsd32_fs.c: revision 1.89

data_len == 0 on mount means "the kernel knows". Fixes amd on compat32.

diffstat:

 sys/compat/netbsd32/netbsd32_fs.c |  34 ++++++++++++++++++++--------------
 1 files changed, 20 insertions(+), 14 deletions(-)

diffs (132 lines):

diff -r a26a0b164749 -r 2fea18a42462 sys/compat/netbsd32/netbsd32_fs.c
--- a/sys/compat/netbsd32/netbsd32_fs.c Sat Apr 01 15:27:07 2023 +0000
+++ b/sys/compat/netbsd32/netbsd32_fs.c Sat Apr 01 15:51:16 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_fs.c,v 1.82.4.3 2022/08/03 11:05:51 martin Exp $      */
+/*     $NetBSD: netbsd32_fs.c,v 1.82.4.4 2023/04/01 15:51:16 martin Exp $      */
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.82.4.3 2022/08/03 11:05:51 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.82.4.4 2023/04/01 15:51:16 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -828,7 +828,7 @@ netbsd32___mount50(struct lwp *l, const 
                return error;
 
        if (strcmp(mtype, MOUNT_TMPFS) == 0) {
-               if (data_len < sizeof(fs_args32.tmpfs_args))
+               if (data_len != 0 && data_len < sizeof(fs_args32.tmpfs_args))
                        return EINVAL;
                if ((flags & MNT_GETARGS) == 0) {
                        error = copyin(data, &fs_args32.tmpfs_args, 
@@ -852,7 +852,7 @@ netbsd32___mount50(struct lwp *l, const 
                data = &fs_args.tmpfs_args;
                data_len = sizeof(fs_args.tmpfs_args);
        } else if (strcmp(mtype, MOUNT_MFS) == 0) {
-               if (data_len < sizeof(fs_args32.mfs_args))
+               if (data_len != 0 && data_len < sizeof(fs_args32.mfs_args))
                        return EINVAL;
                if ((flags & MNT_GETARGS) == 0) {
                        error = copyin(data, &fs_args32.mfs_args, 
@@ -873,7 +873,7 @@ netbsd32___mount50(struct lwp *l, const 
        } else if ((strcmp(mtype, MOUNT_UFS) == 0) ||
                   (strcmp(mtype, MOUNT_EXT2FS) == 0) ||
                   (strcmp(mtype, MOUNT_LFS) == 0)) {
-               if (data_len < sizeof(fs_args32.ufs_args))
+               if (data_len != 0 && data_len < sizeof(fs_args32.ufs_args))
                        return EINVAL;
                if ((flags & MNT_GETARGS) == 0) {
                        error = copyin(data, &fs_args32.ufs_args, 
@@ -887,7 +887,7 @@ netbsd32___mount50(struct lwp *l, const 
                data = &fs_args.ufs_args;
                data_len = sizeof(fs_args.ufs_args);
        } else if (strcmp(mtype, MOUNT_CD9660) == 0) {
-               if (data_len < sizeof(fs_args32.iso_args))
+               if (data_len != 0 && data_len < sizeof(fs_args32.iso_args))
                        return EINVAL;
                if ((flags & MNT_GETARGS) == 0) {
                        error = copyin(data, &fs_args32.iso_args, 
@@ -968,7 +968,7 @@ netbsd32___mount50(struct lwp *l, const 
                data = &fs_args.udf_args;
                data_len = sizeof(fs_args.udf_args);
        } else if (strcmp(mtype, MOUNT_NFS) == 0) {
-               if (data_len < sizeof(fs_args32.nfs_args))
+               if (data_len != 0 && data_len < sizeof(fs_args32.nfs_args))
                        return EINVAL;
                /* XXX: NFS requires copyin even with MNT_GETARGS */
                if ((flags & MNT_GETARGS) == 0) {
@@ -996,7 +996,7 @@ netbsd32___mount50(struct lwp *l, const 
                data = &fs_args.nfs_args;
                data_len = sizeof(fs_args.nfs_args);
        } else if (strcmp(mtype, MOUNT_NULL) == 0) {
-               if (data_len < sizeof(fs_args32.null_args))
+               if (data_len != 0 && data_len < sizeof(fs_args32.null_args))
                        return EINVAL;
                if ((flags & MNT_GETARGS) == 0) {
                        error = copyin(data, &fs_args32.null_args, 
@@ -1021,7 +1021,8 @@ netbsd32___mount50(struct lwp *l, const 
        if (flags & MNT_GETARGS) {
                data_len = *retval;
                if (strcmp(mtype, MOUNT_TMPFS) == 0) {
-                       if (data_len != sizeof(fs_args.tmpfs_args))
+                       if (data_len != 0 &&
+                           data_len != sizeof(fs_args.tmpfs_args))
                                return EINVAL;
                        fs_args32.tmpfs_args.ta_version =
                            fs_args.tmpfs_args.ta_version;
@@ -1039,7 +1040,8 @@ netbsd32___mount50(struct lwp *l, const 
                                    sizeof(fs_args32.tmpfs_args));
                        *retval = sizeof(fs_args32.tmpfs_args);
                } else if (strcmp(mtype, MOUNT_MFS) == 0) {
-                       if (data_len != sizeof(fs_args.mfs_args))
+                       if (data_len != 0 &&
+                           data_len != sizeof(fs_args.mfs_args))
                                return EINVAL;
                        NETBSD32PTR32(fs_args32.mfs_args.fspec,
                            fs_args.mfs_args.fspec);
@@ -1052,7 +1054,8 @@ netbsd32___mount50(struct lwp *l, const 
                                    sizeof(fs_args32.mfs_args));
                        *retval = sizeof(fs_args32.mfs_args);
                } else if (strcmp(mtype, MOUNT_UFS) == 0) {
-                       if (data_len != sizeof(fs_args.ufs_args))
+                       if (data_len != 0 &&
+                           data_len != sizeof(fs_args.ufs_args))
                                return EINVAL;
                        NETBSD32PTR32(fs_args32.ufs_args.fspec,
                            fs_args.ufs_args.fspec);
@@ -1060,7 +1063,8 @@ netbsd32___mount50(struct lwp *l, const 
                            sizeof(fs_args32.ufs_args));
                        *retval = sizeof(fs_args32.ufs_args);
                } else if (strcmp(mtype, MOUNT_CD9660) == 0) {
-                       if (data_len != sizeof(fs_args.iso_args))
+                       if (data_len != 0 &&
+                           data_len != sizeof(fs_args.iso_args))
                                return EINVAL;
                        NETBSD32PTR32(fs_args32.iso_args.fspec,
                            fs_args.iso_args.fspec);
@@ -1100,7 +1104,8 @@ netbsd32___mount50(struct lwp *l, const 
                                    sizeof(fs_args32.udf_args));
                        *retval = sizeof(fs_args32.udf_args);
                } else if (strcmp(mtype, MOUNT_NFS) == 0) {
-                       if (data_len != sizeof(fs_args.nfs_args))
+                       if (data_len != 0 &&
+                           data_len != sizeof(fs_args.nfs_args))
                                return EINVAL;
                        NETBSD32PTR32(fs_args32.nfs_args.addr,
                            fs_args.nfs_args.addr);
@@ -1120,7 +1125,8 @@ netbsd32___mount50(struct lwp *l, const 
                            sizeof(fs_args32.nfs_args));
                        *retval = sizeof(fs_args32.nfs_args);
                } else if (strcmp(mtype, MOUNT_NULL) == 0) {
-                       if (data_len != sizeof(fs_args.null_args))
+                       if (data_len != 0 &&
+                           data_len != sizeof(fs_args.null_args))
                                return EINVAL;
                        NETBSD32PTR32(fs_args32.null_args.la.target,
                            fs_args.null_args.la.target);



Home | Main Index | Thread Index | Old Index