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.
This commit is contained in:
martin 2023-04-01 15:51:16 +00:00
parent a0f3917892
commit e0d20e0298
1 changed files with 20 additions and 14 deletions

View File

@ -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 struct netbsd32___mount50_args *uap,
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 struct netbsd32___mount50_args *uap,
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 struct netbsd32___mount50_args *uap,
} 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 struct netbsd32___mount50_args *uap,
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 struct netbsd32___mount50_args *uap,
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 struct netbsd32___mount50_args *uap,
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 struct netbsd32___mount50_args *uap,
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 struct netbsd32___mount50_args *uap,
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 struct netbsd32___mount50_args *uap,
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 struct netbsd32___mount50_args *uap,
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 struct netbsd32___mount50_args *uap,
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 struct netbsd32___mount50_args *uap,
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);