Commit 78d12716 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] Remove obsolete NFSD syscall varients.

Three varients of the NFSD system call use __kernel_* types in defining
the arg, which is bad: these types should not be exposed to userspace.

Particularly as __kernel_dev_t might change soon.

Two of the varients, getfh and uidmap, are not implemented, getfh is
deprecated and uidmap never was and never will be implemented.

This patch removes (almost) all trace of these two varients, including
all the 32bit-compat system call translators for various 64bit
platforms.

The third varient that uses __kernel_* types, export, is not so easy to
deal with, so it will be kept for later.
parent 8bc68ca8
...@@ -3124,38 +3124,17 @@ struct nfsctl_export32 { ...@@ -3124,38 +3124,17 @@ struct nfsctl_export32 {
compat_gid_t ex32_anon_gid; compat_gid_t ex32_anon_gid;
}; };
struct nfsctl_uidmap32 {
u32 ug32_ident; /* char * */
compat_uid_t ug32_uidbase;
s32 ug32_uidlen;
u32 ug32_udimap; /* uid_t * */
compat_uid_t ug32_gidbase;
s32 ug32_gidlen;
u32 ug32_gdimap; /* gid_t * */
};
struct nfsctl_fhparm32 {
struct sockaddr gf32_addr;
compat_dev_t gf32_dev;
compat_ino_t gf32_ino;
s32 gf32_version;
};
struct nfsctl_arg32 { struct nfsctl_arg32 {
s32 ca32_version; /* safeguard */ s32 ca32_version; /* safeguard */
union { union {
struct nfsctl_svc32 u32_svc; struct nfsctl_svc32 u32_svc;
struct nfsctl_client32 u32_client; struct nfsctl_client32 u32_client;
struct nfsctl_export32 u32_export; struct nfsctl_export32 u32_export;
struct nfsctl_uidmap32 u32_umap;
struct nfsctl_fhparm32 u32_getfh;
u32 u32_debug; u32 u32_debug;
} u; } u;
#define ca32_svc u.u32_svc #define ca32_svc u.u32_svc
#define ca32_client u.u32_client #define ca32_client u.u32_client
#define ca32_export u.u32_export #define ca32_export u.u32_export
#define ca32_umap u.u32_umap
#define ca32_getfh u.u32_getfh
#define ca32_authd u.u32_authd #define ca32_authd u.u32_authd
#define ca32_debug u.u32_debug #define ca32_debug u.u32_debug
}; };
...@@ -3226,75 +3205,6 @@ nfs_exp32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32) ...@@ -3226,75 +3205,6 @@ nfs_exp32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
return err; return err;
} }
static int
nfs_uud32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
{
u32 uaddr;
int i;
int err;
memset(karg, 0, sizeof(*karg));
if(__get_user(karg->ca_version, &arg32->ca32_version))
return -EFAULT;
karg->ca_umap.ug_ident = (char *)get_zeroed_page(GFP_USER);
if(!karg->ca_umap.ug_ident)
return -ENOMEM;
err = __get_user(uaddr, &arg32->ca32_umap.ug32_ident);
if(strncpy_from_user(karg->ca_umap.ug_ident,
(char *)A(uaddr), PAGE_SIZE) <= 0)
return -EFAULT;
err |= __get_user(karg->ca_umap.ug_uidbase,
&arg32->ca32_umap.ug32_uidbase);
err |= __get_user(karg->ca_umap.ug_uidlen,
&arg32->ca32_umap.ug32_uidlen);
err |= __get_user(uaddr, &arg32->ca32_umap.ug32_udimap);
if (err)
return -EFAULT;
karg->ca_umap.ug_udimap = kmalloc((sizeof(uid_t) *
karg->ca_umap.ug_uidlen),
GFP_USER);
if(!karg->ca_umap.ug_udimap)
return -ENOMEM;
for(i = 0; i < karg->ca_umap.ug_uidlen; i++)
err |= __get_user(karg->ca_umap.ug_udimap[i],
&(((compat_uid_t *)A(uaddr))[i]));
err |= __get_user(karg->ca_umap.ug_gidbase,
&arg32->ca32_umap.ug32_gidbase);
err |= __get_user(karg->ca_umap.ug_uidlen,
&arg32->ca32_umap.ug32_gidlen);
err |= __get_user(uaddr, &arg32->ca32_umap.ug32_gdimap);
if (err)
return -EFAULT;
karg->ca_umap.ug_gdimap = kmalloc((sizeof(gid_t) *
karg->ca_umap.ug_uidlen),
GFP_USER);
if(!karg->ca_umap.ug_gdimap)
return -ENOMEM;
for(i = 0; i < karg->ca_umap.ug_gidlen; i++)
err |= __get_user(karg->ca_umap.ug_gdimap[i],
&(((compat_gid_t *)A(uaddr))[i]));
return err;
}
static int
nfs_getfh32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
{
int err;
err = __get_user(karg->ca_version, &arg32->ca32_version);
err |= copy_from_user(&karg->ca_getfh.gf_addr,
&arg32->ca32_getfh.gf32_addr,
(sizeof(struct sockaddr)));
err |= __get_user(karg->ca_getfh.gf_dev,
&arg32->ca32_getfh.gf32_dev);
err |= __get_user(karg->ca_getfh.gf_ino,
&arg32->ca32_getfh.gf32_ino);
err |= __get_user(karg->ca_getfh.gf_version,
&arg32->ca32_getfh.gf32_version);
return err;
}
static int static int
nfs_getfh32_res_trans(union nfsctl_res *kres, union nfsctl_res32 *res32) nfs_getfh32_res_trans(union nfsctl_res *kres, union nfsctl_res32 *res32)
{ {
...@@ -3340,13 +3250,6 @@ sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsctl_res32 *res32) ...@@ -3340,13 +3250,6 @@ sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsctl_res32 *res32)
case NFSCTL_EXPORT: case NFSCTL_EXPORT:
err = nfs_exp32_trans(karg, arg32); err = nfs_exp32_trans(karg, arg32);
break; break;
/* This one is unimplemented, be we're ready for it. */
case NFSCTL_UGIDUPDATE:
err = nfs_uud32_trans(karg, arg32);
break;
case NFSCTL_GETFH:
err = nfs_getfh32_trans(karg, arg32);
break;
default: default:
err = -EINVAL; err = -EINVAL;
break; break;
...@@ -3358,21 +3261,12 @@ sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsctl_res32 *res32) ...@@ -3358,21 +3261,12 @@ sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsctl_res32 *res32)
err = sys_nfsservctl(cmd, karg, kres); err = sys_nfsservctl(cmd, karg, kres);
set_fs(oldfs); set_fs(oldfs);
if(!err && cmd == NFSCTL_GETFH) if(!err && cmd == NFSCTL_GETFS)
err = nfs_getfh32_res_trans(kres, res32); err = nfs_getfh32_res_trans(kres, res32);
done: done:
if(karg) { if(karg)
if(cmd == NFSCTL_UGIDUPDATE) {
if(karg->ca_umap.ug_ident)
kfree(karg->ca_umap.ug_ident);
if(karg->ca_umap.ug_udimap)
kfree(karg->ca_umap.ug_udimap);
if(karg->ca_umap.ug_gdimap)
kfree(karg->ca_umap.ug_gdimap);
}
kfree(karg); kfree(karg);
}
if(kres) if(kres)
kfree(kres); kfree(kres);
return err; return err;
......
...@@ -1282,25 +1282,6 @@ struct nfsctl_export32 { ...@@ -1282,25 +1282,6 @@ struct nfsctl_export32 {
__kernel_gid_t ex_anon_gid; __kernel_gid_t ex_anon_gid;
}; };
/* GETFH */
struct nfsctl_fhparm32 {
struct sockaddr gf_addr;
__kernel_dev_t gf_dev;
compat_ino_t gf_ino;
int gf_version;
};
/* UGIDUPDATE */
struct nfsctl_uidmap32 {
compat_caddr_t ug_ident;
__kernel_uid_t ug_uidbase;
int ug_uidlen;
compat_caddr_t ug_udimap;
__kernel_gid_t ug_gidbase;
int ug_gidlen;
compat_caddr_t ug_gdimap;
};
struct nfsctl_arg32 { struct nfsctl_arg32 {
int ca_version; /* safeguard */ int ca_version; /* safeguard */
/* wide kernel places this union on 8-byte boundary, narrow on 4 */ /* wide kernel places this union on 8-byte boundary, narrow on 4 */
...@@ -1308,8 +1289,6 @@ struct nfsctl_arg32 { ...@@ -1308,8 +1289,6 @@ struct nfsctl_arg32 {
struct nfsctl_svc u_svc; struct nfsctl_svc u_svc;
struct nfsctl_client u_client; struct nfsctl_client u_client;
struct nfsctl_export32 u_export; struct nfsctl_export32 u_export;
struct nfsctl_uidmap32 u_umap;
struct nfsctl_fhparm32 u_getfh;
struct nfsctl_fdparm u_getfd; struct nfsctl_fdparm u_getfd;
struct nfsctl_fsparm u_getfs; struct nfsctl_fsparm u_getfs;
} u; } u;
...@@ -1346,29 +1325,6 @@ asmlinkage int sys32_nfsservctl(int cmd, void *argp, void *resp) ...@@ -1346,29 +1325,6 @@ asmlinkage int sys32_nfsservctl(int cmd, void *argp, void *resp)
ret = copy_from_user(&n.u, argp, sizeof n.u.u_getfs); ret = copy_from_user(&n.u, argp, sizeof n.u.u_getfs);
break; break;
case NFSCTL_GETFH: /* nfsctl_fhparm */
ret = copy_from_user(&n32.u, argp, sizeof n32.u.u_getfh);
#undef CP
#define CP(x) n.u.u_getfh.gf_##x = n32.u.u_getfh.gf_##x
CP(addr);
CP(dev);
CP(ino);
CP(version);
break;
case NFSCTL_UGIDUPDATE: /* nfsctl_uidmap */
ret = copy_from_user(&n32.u, argp, sizeof n32.u.u_umap);
#undef CP
#define CP(x) n.u.u_umap.ug_##x = n32.u.u_umap.ug_##x
n.u.u_umap.ug_ident = (char *)(u_long)n32.u.u_umap.ug_ident;
CP(uidbase);
CP(uidlen);
n.u.u_umap.ug_udimap = (__kernel_uid_t *)(u_long)n32.u.u_umap.ug_udimap;
CP(gidbase);
CP(gidlen);
n.u.u_umap.ug_gdimap = (__kernel_gid_t *)(u_long)n32.u.u_umap.ug_gdimap;
break;
case NFSCTL_UNEXPORT: /* nfsctl_export */ case NFSCTL_UNEXPORT: /* nfsctl_export */
case NFSCTL_EXPORT: /* nfsctl_export */ case NFSCTL_EXPORT: /* nfsctl_export */
ret = copy_from_user(&n32.u, argp, sizeof n32.u.u_export); ret = copy_from_user(&n32.u, argp, sizeof n32.u.u_export);
...@@ -1393,7 +1349,7 @@ asmlinkage int sys32_nfsservctl(int cmd, void *argp, void *resp) ...@@ -1393,7 +1349,7 @@ asmlinkage int sys32_nfsservctl(int cmd, void *argp, void *resp)
if (ret == 0) { if (ret == 0) {
unsigned char rbuf[NFS_FHSIZE + sizeof (struct knfsd_fh)]; unsigned char rbuf[NFS_FHSIZE + sizeof (struct knfsd_fh)];
KERNEL_SYSCALL(ret, sys_nfsservctl, cmd, &n, &rbuf); KERNEL_SYSCALL(ret, sys_nfsservctl, cmd, &n, &rbuf);
if (cmd == NFSCTL_GETFH || cmd == NFSCTL_GETFD) { if (cmd == NFSCTL_GETFD) {
ret = copy_to_user(resp, rbuf, NFS_FHSIZE); ret = copy_to_user(resp, rbuf, NFS_FHSIZE);
} else if (cmd == NFSCTL_GETFS) { } else if (cmd == NFSCTL_GETFS) {
ret = copy_to_user(resp, rbuf, sizeof (struct knfsd_fh)); ret = copy_to_user(resp, rbuf, sizeof (struct knfsd_fh));
......
...@@ -884,23 +884,6 @@ struct nfsctl_export32 { ...@@ -884,23 +884,6 @@ struct nfsctl_export32 {
compat_gid_t ex32_anon_gid; compat_gid_t ex32_anon_gid;
}; };
struct nfsctl_uidmap32 {
u32 ug32_ident; /* char * */
compat_uid_t ug32_uidbase;
s32 ug32_uidlen;
u32 ug32_udimap; /* uid_t * */
compat_uid_t ug32_gidbase;
s32 ug32_gidlen;
u32 ug32_gdimap; /* gid_t * */
};
struct nfsctl_fhparm32 {
struct sockaddr gf32_addr;
compat_dev_t gf32_dev;
compat_ino_t gf32_ino;
s32 gf32_version;
};
struct nfsctl_fdparm32 { struct nfsctl_fdparm32 {
struct sockaddr gd32_addr; struct sockaddr gd32_addr;
s8 gd32_path[NFS_MAXPATHLEN+1]; s8 gd32_path[NFS_MAXPATHLEN+1];
...@@ -919,16 +902,12 @@ struct nfsctl_arg32 { ...@@ -919,16 +902,12 @@ struct nfsctl_arg32 {
struct nfsctl_svc32 u32_svc; struct nfsctl_svc32 u32_svc;
struct nfsctl_client32 u32_client; struct nfsctl_client32 u32_client;
struct nfsctl_export32 u32_export; struct nfsctl_export32 u32_export;
struct nfsctl_uidmap32 u32_umap;
struct nfsctl_fhparm32 u32_getfh;
struct nfsctl_fdparm32 u32_getfd; struct nfsctl_fdparm32 u32_getfd;
struct nfsctl_fsparm32 u32_getfs; struct nfsctl_fsparm32 u32_getfs;
} u; } u;
#define ca32_svc u.u32_svc #define ca32_svc u.u32_svc
#define ca32_client u.u32_client #define ca32_client u.u32_client
#define ca32_export u.u32_export #define ca32_export u.u32_export
#define ca32_umap u.u32_umap
#define ca32_getfh u.u32_getfh
#define ca32_getfd u.u32_getfd #define ca32_getfd u.u32_getfd
#define ca32_getfs u.u32_getfs #define ca32_getfs u.u32_getfs
#define ca32_authd u.u32_authd #define ca32_authd u.u32_authd
...@@ -1001,73 +980,6 @@ static int nfs_exp32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32) ...@@ -1001,73 +980,6 @@ static int nfs_exp32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
return 0; return 0;
} }
static int nfs_uud32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
{
u32 uaddr;
int i;
int err;
memset(karg, 0, sizeof(*karg));
if(__get_user(karg->ca_version, &arg32->ca32_version))
return -EFAULT;
karg->ca_umap.ug_ident = (char *)get_zeroed_page(GFP_USER);
if(!karg->ca_umap.ug_ident)
return -ENOMEM;
err = __get_user(uaddr, &arg32->ca32_umap.ug32_ident);
if(strncpy_from_user(karg->ca_umap.ug_ident,
(char *)A(uaddr), PAGE_SIZE) <= 0)
return -EFAULT;
err |= __get_user(karg->ca_umap.ug_uidbase,
&arg32->ca32_umap.ug32_uidbase);
err |= __get_user(karg->ca_umap.ug_uidlen,
&arg32->ca32_umap.ug32_uidlen);
err |= __get_user(uaddr, &arg32->ca32_umap.ug32_udimap);
if (err)
return -EFAULT;
karg->ca_umap.ug_udimap = kmalloc((sizeof(uid_t) * karg->ca_umap.ug_uidlen),
GFP_USER);
if(!karg->ca_umap.ug_udimap)
return -ENOMEM;
for(i = 0; i < karg->ca_umap.ug_uidlen; i++)
err |= __get_user(karg->ca_umap.ug_udimap[i],
&(((compat_uid_t *)A(uaddr))[i]));
err |= __get_user(karg->ca_umap.ug_gidbase,
&arg32->ca32_umap.ug32_gidbase);
err |= __get_user(karg->ca_umap.ug_uidlen,
&arg32->ca32_umap.ug32_gidlen);
err |= __get_user(uaddr, &arg32->ca32_umap.ug32_gdimap);
if (err)
return -EFAULT;
karg->ca_umap.ug_gdimap = kmalloc((sizeof(gid_t) * karg->ca_umap.ug_uidlen),
GFP_USER);
if(!karg->ca_umap.ug_gdimap)
return -ENOMEM;
for(i = 0; i < karg->ca_umap.ug_gidlen; i++)
err |= __get_user(karg->ca_umap.ug_gdimap[i],
&(((compat_gid_t *)A(uaddr))[i]));
return err;
}
static int nfs_getfh32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
{
int err;
err = __get_user(karg->ca_version, &arg32->ca32_version);
err |= copy_from_user(&karg->ca_getfh.gf_addr,
&arg32->ca32_getfh.gf32_addr,
(sizeof(struct sockaddr)));
err |= __get_user(karg->ca_getfh.gf_dev,
&arg32->ca32_getfh.gf32_dev);
err |= __get_user(karg->ca_getfh.gf_ino,
&arg32->ca32_getfh.gf32_ino);
err |= __get_user(karg->ca_getfh.gf_version,
&arg32->ca32_getfh.gf32_version);
if(err) return -EFAULT;
return 0;
}
static int nfs_getfd32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32) static int nfs_getfd32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
{ {
int err; int err;
...@@ -1154,13 +1066,6 @@ int asmlinkage sys32_nfsservctl(u32 cmd_parm, struct nfsctl_arg32 *arg32, union ...@@ -1154,13 +1066,6 @@ int asmlinkage sys32_nfsservctl(u32 cmd_parm, struct nfsctl_arg32 *arg32, union
case NFSCTL_UNEXPORT: case NFSCTL_UNEXPORT:
err = nfs_exp32_trans(karg, arg32); err = nfs_exp32_trans(karg, arg32);
break; break;
/* This one is unimplemented, be we're ready for it. */
case NFSCTL_UGIDUPDATE:
err = nfs_uud32_trans(karg, arg32);
break;
case NFSCTL_GETFH:
err = nfs_getfh32_trans(karg, arg32);
break;
case NFSCTL_GETFD: case NFSCTL_GETFD:
err = nfs_getfd32_trans(karg, arg32); err = nfs_getfd32_trans(karg, arg32);
break; break;
...@@ -1181,23 +1086,13 @@ int asmlinkage sys32_nfsservctl(u32 cmd_parm, struct nfsctl_arg32 *arg32, union ...@@ -1181,23 +1086,13 @@ int asmlinkage sys32_nfsservctl(u32 cmd_parm, struct nfsctl_arg32 *arg32, union
if (err) if (err)
goto done; goto done;
if((cmd == NFSCTL_GETFH) || if((cmd == NFSCTL_GETFD) ||
(cmd == NFSCTL_GETFD) ||
(cmd == NFSCTL_GETFS)) (cmd == NFSCTL_GETFS))
err = nfs_getfh32_res_trans(kres, res32); err = nfs_getfh32_res_trans(kres, res32);
done: done:
if(karg) { if(karg)
if(cmd == NFSCTL_UGIDUPDATE) {
if(karg->ca_umap.ug_ident)
kfree(karg->ca_umap.ug_ident);
if(karg->ca_umap.ug_udimap)
kfree(karg->ca_umap.ug_udimap);
if(karg->ca_umap.ug_gdimap)
kfree(karg->ca_umap.ug_gdimap);
}
kfree(karg); kfree(karg);
}
if(kres) if(kres)
kfree(kres); kfree(kres);
return err; return err;
......
...@@ -2092,23 +2092,6 @@ struct nfsctl_export32 { ...@@ -2092,23 +2092,6 @@ struct nfsctl_export32 {
compat_gid_t ex32_anon_gid; compat_gid_t ex32_anon_gid;
}; };
struct nfsctl_uidmap32 {
u32 ug32_ident; /* char * */
compat_uid_t ug32_uidbase;
s32 ug32_uidlen;
u32 ug32_udimap; /* uid_t * */
compat_uid_t ug32_gidbase;
s32 ug32_gidlen;
u32 ug32_gdimap; /* gid_t * */
};
struct nfsctl_fhparm32 {
struct sockaddr gf32_addr;
compat_dev_t gf32_dev;
compat_ino_t gf32_ino;
s32 gf32_version;
};
struct nfsctl_fdparm32 { struct nfsctl_fdparm32 {
struct sockaddr gd32_addr; struct sockaddr gd32_addr;
s8 gd32_path[NFS_MAXPATHLEN+1]; s8 gd32_path[NFS_MAXPATHLEN+1];
...@@ -2127,16 +2110,12 @@ struct nfsctl_arg32 { ...@@ -2127,16 +2110,12 @@ struct nfsctl_arg32 {
struct nfsctl_svc32 u32_svc; struct nfsctl_svc32 u32_svc;
struct nfsctl_client32 u32_client; struct nfsctl_client32 u32_client;
struct nfsctl_export32 u32_export; struct nfsctl_export32 u32_export;
struct nfsctl_uidmap32 u32_umap;
struct nfsctl_fhparm32 u32_getfh;
struct nfsctl_fdparm32 u32_getfd; struct nfsctl_fdparm32 u32_getfd;
struct nfsctl_fsparm32 u32_getfs; struct nfsctl_fsparm32 u32_getfs;
} u; } u;
#define ca32_svc u.u32_svc #define ca32_svc u.u32_svc
#define ca32_client u.u32_client #define ca32_client u.u32_client
#define ca32_export u.u32_export #define ca32_export u.u32_export
#define ca32_umap u.u32_umap
#define ca32_getfh u.u32_getfh
#define ca32_getfd u.u32_getfd #define ca32_getfd u.u32_getfd
#define ca32_getfs u.u32_getfs #define ca32_getfs u.u32_getfs
#define ca32_authd u.u32_authd #define ca32_authd u.u32_authd
...@@ -2205,71 +2184,6 @@ static int nfs_exp32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32) ...@@ -2205,71 +2184,6 @@ static int nfs_exp32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
return err; return err;
} }
static int nfs_uud32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
{
u32 uaddr;
int i;
int err;
memset(karg, 0, sizeof(*karg));
if(__get_user(karg->ca_version, &arg32->ca32_version))
return -EFAULT;
karg->ca_umap.ug_ident = (char *)get_zeroed_page(GFP_USER);
if(!karg->ca_umap.ug_ident)
return -ENOMEM;
err = __get_user(uaddr, &arg32->ca32_umap.ug32_ident);
if(strncpy_from_user(karg->ca_umap.ug_ident,
(char *)A(uaddr), PAGE_SIZE) <= 0)
return -EFAULT;
err |= __get_user(karg->ca_umap.ug_uidbase,
&arg32->ca32_umap.ug32_uidbase);
err |= __get_user(karg->ca_umap.ug_uidlen,
&arg32->ca32_umap.ug32_uidlen);
err |= __get_user(uaddr, &arg32->ca32_umap.ug32_udimap);
if (err)
return -EFAULT;
karg->ca_umap.ug_udimap = kmalloc((sizeof(uid_t) * karg->ca_umap.ug_uidlen),
GFP_USER);
if(!karg->ca_umap.ug_udimap)
return -ENOMEM;
for(i = 0; i < karg->ca_umap.ug_uidlen; i++)
err |= __get_user(karg->ca_umap.ug_udimap[i],
&(((compat_uid_t *)A(uaddr))[i]));
err |= __get_user(karg->ca_umap.ug_gidbase,
&arg32->ca32_umap.ug32_gidbase);
err |= __get_user(karg->ca_umap.ug_uidlen,
&arg32->ca32_umap.ug32_gidlen);
err |= __get_user(uaddr, &arg32->ca32_umap.ug32_gdimap);
if (err)
return -EFAULT;
karg->ca_umap.ug_gdimap = kmalloc((sizeof(gid_t) * karg->ca_umap.ug_uidlen),
GFP_USER);
if(!karg->ca_umap.ug_gdimap)
return -ENOMEM;
for(i = 0; i < karg->ca_umap.ug_gidlen; i++)
err |= __get_user(karg->ca_umap.ug_gdimap[i],
&(((compat_gid_t *)A(uaddr))[i]));
return err;
}
static int nfs_getfh32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
{
int err;
err = __get_user(karg->ca_version, &arg32->ca32_version);
err |= copy_from_user(&karg->ca_getfh.gf_addr,
&arg32->ca32_getfh.gf32_addr,
(sizeof(struct sockaddr)));
err |= __get_user(karg->ca_getfh.gf_dev,
&arg32->ca32_getfh.gf32_dev);
err |= __get_user(karg->ca_getfh.gf_ino,
&arg32->ca32_getfh.gf32_ino);
err |= __get_user(karg->ca_getfh.gf_version,
&arg32->ca32_getfh.gf32_version);
return err;
}
static int nfs_getfd32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32) static int nfs_getfd32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
{ {
int err; int err;
...@@ -2345,13 +2259,6 @@ int asmlinkage sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsct ...@@ -2345,13 +2259,6 @@ int asmlinkage sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsct
case NFSCTL_UNEXPORT: case NFSCTL_UNEXPORT:
err = nfs_exp32_trans(karg, arg32); err = nfs_exp32_trans(karg, arg32);
break; break;
/* This one is unimplemented, be we're ready for it. */
case NFSCTL_UGIDUPDATE:
err = nfs_uud32_trans(karg, arg32);
break;
case NFSCTL_GETFH:
err = nfs_getfh32_trans(karg, arg32);
break;
case NFSCTL_GETFD: case NFSCTL_GETFD:
err = nfs_getfd32_trans(karg, arg32); err = nfs_getfd32_trans(karg, arg32);
break; break;
...@@ -2372,23 +2279,13 @@ int asmlinkage sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsct ...@@ -2372,23 +2279,13 @@ int asmlinkage sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsct
if (err) if (err)
goto done; goto done;
if((cmd == NFSCTL_GETFH) || if((cmd == NFSCTL_GETFD) ||
(cmd == NFSCTL_GETFD) ||
(cmd == NFSCTL_GETFS)) (cmd == NFSCTL_GETFS))
err = nfs_getfh32_res_trans(kres, res32); err = nfs_getfh32_res_trans(kres, res32);
done: done:
if(karg) { if(karg)
if(cmd == NFSCTL_UGIDUPDATE) {
if(karg->ca_umap.ug_ident)
kfree(karg->ca_umap.ug_ident);
if(karg->ca_umap.ug_udimap)
kfree(karg->ca_umap.ug_udimap);
if(karg->ca_umap.ug_gdimap)
kfree(karg->ca_umap.ug_gdimap);
}
kfree(karg); kfree(karg);
}
if(kres) if(kres)
kfree(kres); kfree(kres);
return err; return err;
......
...@@ -2234,23 +2234,6 @@ struct nfsctl_export32 { ...@@ -2234,23 +2234,6 @@ struct nfsctl_export32 {
compat_gid_t ex32_anon_gid; compat_gid_t ex32_anon_gid;
}; };
struct nfsctl_uidmap32 {
u32 ug32_ident; /* char * */
compat_uid_t ug32_uidbase;
s32 ug32_uidlen;
u32 ug32_udimap; /* uid_t * */
compat_uid_t ug32_gidbase;
s32 ug32_gidlen;
u32 ug32_gdimap; /* gid_t * */
};
struct nfsctl_fhparm32 {
struct sockaddr gf32_addr;
compat_dev_t gf32_dev;
compat_ino_t gf32_ino;
s32 gf32_version;
};
struct nfsctl_fdparm32 { struct nfsctl_fdparm32 {
struct sockaddr gd32_addr; struct sockaddr gd32_addr;
s8 gd32_path[NFS_MAXPATHLEN+1]; s8 gd32_path[NFS_MAXPATHLEN+1];
...@@ -2269,16 +2252,12 @@ struct nfsctl_arg32 { ...@@ -2269,16 +2252,12 @@ struct nfsctl_arg32 {
struct nfsctl_svc32 u32_svc; struct nfsctl_svc32 u32_svc;
struct nfsctl_client32 u32_client; struct nfsctl_client32 u32_client;
struct nfsctl_export32 u32_export; struct nfsctl_export32 u32_export;
struct nfsctl_uidmap32 u32_umap;
struct nfsctl_fhparm32 u32_getfh;
struct nfsctl_fdparm32 u32_getfd; struct nfsctl_fdparm32 u32_getfd;
struct nfsctl_fsparm32 u32_getfs; struct nfsctl_fsparm32 u32_getfs;
} u; } u;
#define ca32_svc u.u32_svc #define ca32_svc u.u32_svc
#define ca32_client u.u32_client #define ca32_client u.u32_client
#define ca32_export u.u32_export #define ca32_export u.u32_export
#define ca32_umap u.u32_umap
#define ca32_getfh u.u32_getfh
#define ca32_getfd u.u32_getfd #define ca32_getfd u.u32_getfd
#define ca32_getfs u.u32_getfs #define ca32_getfs u.u32_getfs
#define ca32_authd u.u32_authd #define ca32_authd u.u32_authd
...@@ -2347,71 +2326,6 @@ static int nfs_exp32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32) ...@@ -2347,71 +2326,6 @@ static int nfs_exp32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
return (err ? -EFAULT : 0); return (err ? -EFAULT : 0);
} }
static int nfs_uud32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
{
u32 uaddr;
int i;
int err;
memset(karg, 0, sizeof(*karg));
if(__get_user(karg->ca_version, &arg32->ca32_version))
return -EFAULT;
karg->ca_umap.ug_ident = (char *)get_zeroed_page(GFP_USER);
if(!karg->ca_umap.ug_ident)
return -ENOMEM;
err = __get_user(uaddr, &arg32->ca32_umap.ug32_ident);
if(strncpy_from_user(karg->ca_umap.ug_ident,
(char *)A(uaddr), PAGE_SIZE) <= 0)
return -EFAULT;
err |= __get_user(karg->ca_umap.ug_uidbase,
&arg32->ca32_umap.ug32_uidbase);
err |= __get_user(karg->ca_umap.ug_uidlen,
&arg32->ca32_umap.ug32_uidlen);
err |= __get_user(uaddr, &arg32->ca32_umap.ug32_udimap);
if (err)
return -EFAULT;
karg->ca_umap.ug_udimap = kmalloc((sizeof(uid_t) * karg->ca_umap.ug_uidlen),
GFP_USER);
if(!karg->ca_umap.ug_udimap)
return -ENOMEM;
for(i = 0; i < karg->ca_umap.ug_uidlen; i++)
err |= __get_user(karg->ca_umap.ug_udimap[i],
&(((compat_uid_t *)A(uaddr))[i]));
err |= __get_user(karg->ca_umap.ug_gidbase,
&arg32->ca32_umap.ug32_gidbase);
err |= __get_user(karg->ca_umap.ug_uidlen,
&arg32->ca32_umap.ug32_gidlen);
err |= __get_user(uaddr, &arg32->ca32_umap.ug32_gdimap);
if (err)
return -EFAULT;
karg->ca_umap.ug_gdimap = kmalloc((sizeof(gid_t) * karg->ca_umap.ug_uidlen),
GFP_USER);
if(!karg->ca_umap.ug_gdimap)
return -ENOMEM;
for(i = 0; i < karg->ca_umap.ug_gidlen; i++)
err |= __get_user(karg->ca_umap.ug_gdimap[i],
&(((compat_gid_t *)A(uaddr))[i]));
return (err ? -EFAULT : 0);
}
static int nfs_getfh32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
{
int err;
err = __get_user(karg->ca_version, &arg32->ca32_version);
err |= copy_from_user(&karg->ca_getfh.gf_addr,
&arg32->ca32_getfh.gf32_addr,
(sizeof(struct sockaddr)));
err |= __get_user(karg->ca_getfh.gf_dev,
&arg32->ca32_getfh.gf32_dev);
err |= __get_user(karg->ca_getfh.gf_ino,
&arg32->ca32_getfh.gf32_ino);
err |= __get_user(karg->ca_getfh.gf_version,
&arg32->ca32_getfh.gf32_version);
return (err ? -EFAULT : 0);
}
static int nfs_getfd32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32) static int nfs_getfd32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
{ {
int err; int err;
...@@ -2483,13 +2397,6 @@ int asmlinkage sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsct ...@@ -2483,13 +2397,6 @@ int asmlinkage sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsct
case NFSCTL_UNEXPORT: case NFSCTL_UNEXPORT:
err = nfs_exp32_trans(karg, arg32); err = nfs_exp32_trans(karg, arg32);
break; break;
/* This one is unimplemented, be we're ready for it. */
case NFSCTL_UGIDUPDATE:
err = nfs_uud32_trans(karg, arg32);
break;
case NFSCTL_GETFH:
err = nfs_getfh32_trans(karg, arg32);
break;
case NFSCTL_GETFD: case NFSCTL_GETFD:
err = nfs_getfd32_trans(karg, arg32); err = nfs_getfd32_trans(karg, arg32);
break; break;
...@@ -2510,23 +2417,13 @@ int asmlinkage sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsct ...@@ -2510,23 +2417,13 @@ int asmlinkage sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsct
if (err) if (err)
goto done; goto done;
if((cmd == NFSCTL_GETFH) || if((cmd == NFSCTL_GETFD) ||
(cmd == NFSCTL_GETFD) ||
(cmd == NFSCTL_GETFS)) (cmd == NFSCTL_GETFS))
err = nfs_getfh32_res_trans(kres, res32); err = nfs_getfh32_res_trans(kres, res32);
done: done:
if(karg) { if(karg)
if(cmd == NFSCTL_UGIDUPDATE) {
if(karg->ca_umap.ug_ident)
kfree(karg->ca_umap.ug_ident);
if(karg->ca_umap.ug_udimap)
kfree(karg->ca_umap.ug_udimap);
if(karg->ca_umap.ug_gdimap)
kfree(karg->ca_umap.ug_gdimap);
}
kfree(karg); kfree(karg);
}
if(kres) if(kres)
kfree(kres); kfree(kres);
return err; return err;
......
...@@ -1807,23 +1807,6 @@ struct nfsctl_export32 { ...@@ -1807,23 +1807,6 @@ struct nfsctl_export32 {
compat_gid_t ex32_anon_gid; compat_gid_t ex32_anon_gid;
}; };
struct nfsctl_uidmap32 {
u32 ug32_ident; /* char * */
compat_pid_t ug32_uidbase;
s32 ug32_uidlen;
u32 ug32_udimap; /* uid_t * */
compat_pid_t ug32_gidbase;
s32 ug32_gidlen;
u32 ug32_gdimap; /* gid_t * */
};
struct nfsctl_fhparm32 {
struct sockaddr gf32_addr;
compat_dev_t gf32_dev;
compat_ino_t gf32_ino;
s32 gf32_version;
};
struct nfsctl_fdparm32 { struct nfsctl_fdparm32 {
struct sockaddr gd32_addr; struct sockaddr gd32_addr;
s8 gd32_path[NFS_MAXPATHLEN+1]; s8 gd32_path[NFS_MAXPATHLEN+1];
...@@ -1842,16 +1825,12 @@ struct nfsctl_arg32 { ...@@ -1842,16 +1825,12 @@ struct nfsctl_arg32 {
struct nfsctl_svc32 u32_svc; struct nfsctl_svc32 u32_svc;
struct nfsctl_client32 u32_client; struct nfsctl_client32 u32_client;
struct nfsctl_export32 u32_export; struct nfsctl_export32 u32_export;
struct nfsctl_uidmap32 u32_umap;
struct nfsctl_fhparm32 u32_getfh;
struct nfsctl_fdparm32 u32_getfd; struct nfsctl_fdparm32 u32_getfd;
struct nfsctl_fsparm32 u32_getfs; struct nfsctl_fsparm32 u32_getfs;
} u; } u;
#define ca32_svc u.u32_svc #define ca32_svc u.u32_svc
#define ca32_client u.u32_client #define ca32_client u.u32_client
#define ca32_export u.u32_export #define ca32_export u.u32_export
#define ca32_umap u.u32_umap
#define ca32_getfh u.u32_getfh
#define ca32_getfd u.u32_getfd #define ca32_getfd u.u32_getfd
#define ca32_getfs u.u32_getfs #define ca32_getfs u.u32_getfs
#define ca32_authd u.u32_authd #define ca32_authd u.u32_authd
...@@ -1920,22 +1899,6 @@ static int nfs_exp32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32) ...@@ -1920,22 +1899,6 @@ static int nfs_exp32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
return err; return err;
} }
static int nfs_getfh32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
{
int err;
err = get_user(karg->ca_version, &arg32->ca32_version);
err |= copy_from_user(&karg->ca_getfh.gf_addr,
&arg32->ca32_getfh.gf32_addr,
(sizeof(struct sockaddr)));
err |= __get_user(karg->ca_getfh.gf_dev,
&arg32->ca32_getfh.gf32_dev);
err |= __get_user(karg->ca_getfh.gf_ino,
&arg32->ca32_getfh.gf32_ino);
err |= __get_user(karg->ca_getfh.gf_version,
&arg32->ca32_getfh.gf32_version);
return err;
}
static int nfs_getfd32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32) static int nfs_getfd32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
{ {
...@@ -2008,9 +1971,6 @@ long asmlinkage sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsc ...@@ -2008,9 +1971,6 @@ long asmlinkage sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsc
case NFSCTL_UNEXPORT: case NFSCTL_UNEXPORT:
err = nfs_exp32_trans(karg, arg32); err = nfs_exp32_trans(karg, arg32);
break; break;
case NFSCTL_GETFH:
err = nfs_getfh32_trans(karg, arg32);
break;
case NFSCTL_GETFD: case NFSCTL_GETFD:
err = nfs_getfd32_trans(karg, arg32); err = nfs_getfd32_trans(karg, arg32);
break; break;
...@@ -2031,23 +1991,13 @@ long asmlinkage sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsc ...@@ -2031,23 +1991,13 @@ long asmlinkage sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsc
if (err) if (err)
goto done; goto done;
if((cmd == NFSCTL_GETFH) || if((cmd == NFSCTL_GETFD) ||
(cmd == NFSCTL_GETFD) ||
(cmd == NFSCTL_GETFS)) (cmd == NFSCTL_GETFS))
err = nfs_getfh32_res_trans(kres, res32); err = nfs_getfh32_res_trans(kres, res32);
done: done:
if(karg) { if(karg)
if(cmd == NFSCTL_UGIDUPDATE) {
if(karg->ca_umap.ug_ident)
kfree(karg->ca_umap.ug_ident);
if(karg->ca_umap.ug_udimap)
kfree(karg->ca_umap.ug_udimap);
if(karg->ca_umap.ug_gdimap)
kfree(karg->ca_umap.ug_gdimap);
}
kfree(karg); kfree(karg);
}
if(kres) if(kres)
kfree(kres); kfree(kres);
return err; return err;
......
...@@ -34,8 +34,8 @@ ...@@ -34,8 +34,8 @@
#define NFSCTL_DELCLIENT 2 /* Remove an NFS client. */ #define NFSCTL_DELCLIENT 2 /* Remove an NFS client. */
#define NFSCTL_EXPORT 3 /* export a file system. */ #define NFSCTL_EXPORT 3 /* export a file system. */
#define NFSCTL_UNEXPORT 4 /* unexport a file system. */ #define NFSCTL_UNEXPORT 4 /* unexport a file system. */
#define NFSCTL_UGIDUPDATE 5 /* update a client's uid/gid map. */ /*#define NFSCTL_UGIDUPDATE 5 / * update a client's uid/gid map. DISCARDED */
#define NFSCTL_GETFH 6 /* get an fh by ino (used by mountd) */ /*#define NFSCTL_GETFH 6 / * get an fh by ino DISCARDED */
#define NFSCTL_GETFD 7 /* get an fh by path (used by mountd) */ #define NFSCTL_GETFD 7 /* get an fh by path (used by mountd) */
#define NFSCTL_GETFS 8 /* get an fh by path with max FH len */ #define NFSCTL_GETFS 8 /* get an fh by path with max FH len */
...@@ -66,25 +66,6 @@ struct nfsctl_export { ...@@ -66,25 +66,6 @@ struct nfsctl_export {
__kernel_gid_t ex_anon_gid; __kernel_gid_t ex_anon_gid;
}; };
/* UGIDUPDATE */
struct nfsctl_uidmap {
char * ug_ident;
__kernel_uid_t ug_uidbase;
int ug_uidlen;
__kernel_uid_t * ug_udimap;
__kernel_gid_t ug_gidbase;
int ug_gidlen;
__kernel_gid_t * ug_gdimap;
};
/* GETFH */
struct nfsctl_fhparm {
struct sockaddr gf_addr;
__kernel_dev_t gf_dev;
__kernel_ino_t gf_ino;
int gf_version;
};
/* GETFD */ /* GETFD */
struct nfsctl_fdparm { struct nfsctl_fdparm {
struct sockaddr gd_addr; struct sockaddr gd_addr;
...@@ -108,16 +89,12 @@ struct nfsctl_arg { ...@@ -108,16 +89,12 @@ struct nfsctl_arg {
struct nfsctl_svc u_svc; struct nfsctl_svc u_svc;
struct nfsctl_client u_client; struct nfsctl_client u_client;
struct nfsctl_export u_export; struct nfsctl_export u_export;
struct nfsctl_uidmap u_umap;
struct nfsctl_fhparm u_getfh;
struct nfsctl_fdparm u_getfd; struct nfsctl_fdparm u_getfd;
struct nfsctl_fsparm u_getfs; struct nfsctl_fsparm u_getfs;
} u; } u;
#define ca_svc u.u_svc #define ca_svc u.u_svc
#define ca_client u.u_client #define ca_client u.u_client
#define ca_export u.u_export #define ca_export u.u_export
#define ca_umap u.u_umap
#define ca_getfh u.u_getfh
#define ca_getfd u.u_getfd #define ca_getfd u.u_getfd
#define ca_getfs u.u_getfs #define ca_getfs u.u_getfs
#define ca_authd u.u_authd #define ca_authd u.u_authd
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment