From 1d4d5b325315f064e8cd4efaefbe50cdda0357c7 Mon Sep 17 00:00:00 2001 From: David Brownell Date: Sun, 17 Apr 2005 10:57:20 -0700 Subject: [PATCH] revert fs/char_dev.c CONFIG_BASE_FULL change This reverts a fs/char_dev.c patch that was merged into BK on March 3. The problem is that it breaks things ... __register_chrdev_region() has a block of code, commented "temporary" for over two years now, which fails rudely during PCMCIA initialization or other register_chrdev() calls, because it doesn't "degrade to linked list". This keeps whole subsystems from working. A real fix to that "temporary" code should be possible, using some better scheme to allocate major numbers, but it's not something I want to spend time on just now. Signed-off-by: David Brownell Acked-by: Matt Mackall Signed-off-by: Linus Torvalds --- fs/char_dev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'fs') diff --git a/fs/char_dev.c b/fs/char_dev.c index 7357a9127d..a745b1d9e5 100644 --- a/fs/char_dev.c +++ b/fs/char_dev.c @@ -26,8 +26,7 @@ static struct kobj_map *cdev_map; -/* degrade to linked list for small systems */ -#define MAX_PROBE_HASH (CONFIG_BASE_SMALL ? 1 : 255) +#define MAX_PROBE_HASH 255 /* random */ static DECLARE_MUTEX(chrdevs_lock); -- cgit v1.2.2 From 9a9947bf7a3a14d2107cb9a27279fc8f463370a9 Mon Sep 17 00:00:00 2001 From: David Howells Date: Mon, 18 Apr 2005 10:54:51 -0700 Subject: [PATCH] Add 32-bit compatibility for NFSv4 mount This adds 32-bit compatibility for mounting an NFSv4 mount on a 64-bit kernel (such as happens with PPC64). The problem is that the mount data for the NFS4 mount process includes auxilliary data pointers, probably because the NFS4 mount data may conceivably exceed PAGE_SIZE in size - thus breaking against the hard limit imposed by sys_mount(). Signed-Off-By: David Howells Signed-off-by: Linus Torvalds --- fs/compat.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) (limited to 'fs') diff --git a/fs/compat.c b/fs/compat.c index a912bdf691..67c0b94d11 100644 --- a/fs/compat.c +++ b/fs/compat.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -806,10 +807,79 @@ static void *do_smb_super_data_conv(void *raw_data) return raw_data; } +struct compat_nfs_string { + compat_uint_t len; + compat_uptr_t __user data; +}; + +static inline void compat_nfs_string(struct nfs_string *dst, + struct compat_nfs_string *src) +{ + dst->data = compat_ptr(src->data); + dst->len = src->len; +} + +struct compat_nfs4_mount_data_v1 { + compat_int_t version; + compat_int_t flags; + compat_int_t rsize; + compat_int_t wsize; + compat_int_t timeo; + compat_int_t retrans; + compat_int_t acregmin; + compat_int_t acregmax; + compat_int_t acdirmin; + compat_int_t acdirmax; + struct compat_nfs_string client_addr; + struct compat_nfs_string mnt_path; + struct compat_nfs_string hostname; + compat_uint_t host_addrlen; + compat_uptr_t __user host_addr; + compat_int_t proto; + compat_int_t auth_flavourlen; + compat_uptr_t __user auth_flavours; +}; + +static int do_nfs4_super_data_conv(void *raw_data) +{ + int version = *(compat_uint_t *) raw_data; + + if (version == 1) { + struct compat_nfs4_mount_data_v1 *raw = raw_data; + struct nfs4_mount_data *real = raw_data; + + /* copy the fields backwards */ + real->auth_flavours = compat_ptr(raw->auth_flavours); + real->auth_flavourlen = raw->auth_flavourlen; + real->proto = raw->proto; + real->host_addr = compat_ptr(raw->host_addr); + real->host_addrlen = raw->host_addrlen; + compat_nfs_string(&real->hostname, &raw->hostname); + compat_nfs_string(&real->mnt_path, &raw->mnt_path); + compat_nfs_string(&real->client_addr, &raw->client_addr); + real->acdirmax = raw->acdirmax; + real->acdirmin = raw->acdirmin; + real->acregmax = raw->acregmax; + real->acregmin = raw->acregmin; + real->retrans = raw->retrans; + real->timeo = raw->timeo; + real->wsize = raw->wsize; + real->rsize = raw->rsize; + real->flags = raw->flags; + real->version = raw->version; + } + else { + return -EINVAL; + } + + return 0; +} + extern int copy_mount_options (const void __user *, unsigned long *); #define SMBFS_NAME "smbfs" #define NCPFS_NAME "ncpfs" +#define NFS4_NAME "nfs4" asmlinkage long compat_sys_mount(char __user * dev_name, char __user * dir_name, char __user * type, unsigned long flags, @@ -845,6 +915,9 @@ asmlinkage long compat_sys_mount(char __user * dev_name, char __user * dir_name, do_smb_super_data_conv((void *)data_page); } else if (!strcmp((char *)type_page, NCPFS_NAME)) { do_ncp_super_data_conv((void *)data_page); + } else if (!strcmp((char *)type_page, NFS4_NAME)) { + if (do_nfs4_super_data_conv((void *) data_page)) + goto out4; } } @@ -853,6 +926,7 @@ asmlinkage long compat_sys_mount(char __user * dev_name, char __user * dir_name, flags, (void*)data_page); unlock_kernel(); + out4: free_page(data_page); out3: free_page(dev_page); -- cgit v1.2.2