Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull misc vfs updates from Al Viro: "All kinds of stuff. That probably should've been 5 or 6 separate branches, but by the time I'd realized how large and mixed that bag had become it had been too close to -final to play with rebasing. Some fs/namei.c cleanups there, memdup_user_nul() introduction and switching open-coded instances, burying long-dead code, whack-a-mole of various kinds, several new helpers for ->llseek(), assorted cleanups and fixes from various people, etc. One piece probably deserves special mention - Neil's lookup_one_len_unlocked(). Similar to lookup_one_len(), but gets called without ->i_mutex and tries to avoid ever taking it. That, of course, means that it's not useful for any directory modifications, but things like getting inode attributes in nfds readdirplus are fine with that. I really should've asked for moratorium on lookup-related changes this cycle, but since I hadn't done that early enough... I *am* asking for that for the coming cycle, though - I'm going to try and get conversion of i_mutex to rwsem with ->lookup() done under lock taken shared. There will be a patch closer to the end of the window, along the lines of the one Linus had posted last May - mechanical conversion of ->i_mutex accesses to inode_lock()/inode_unlock()/inode_trylock()/ inode_is_locked()/inode_lock_nested(). To quote Linus back then: ----- | This is an automated patch using | | sed 's/mutex_lock(&\(.*\)->i_mutex)/inode_lock(\1)/' | sed 's/mutex_unlock(&\(.*\)->i_mutex)/inode_unlock(\1)/' | sed 's/mutex_lock_nested(&\(.*\)->i_mutex,[ ]*I_MUTEX_\([A-Z0-9_]*\))/inode_lock_nested(\1, I_MUTEX_\2)/' | sed 's/mutex_is_locked(&\(.*\)->i_mutex)/inode_is_locked(\1)/' | sed 's/mutex_trylock(&\(.*\)->i_mutex)/inode_trylock(\1)/' | | with a very few manual fixups ----- I'm going to send that once the ->i_mutex-affecting stuff in -next gets mostly merged (or when Linus says he's about to stop taking merges)" * 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (63 commits) nfsd: don't hold i_mutex over userspace upcalls fs:affs:Replace time_t with time64_t fs/9p: use fscache mutex rather than spinlock proc: add a reschedule point in proc_readfd_common() logfs: constify logfs_block_ops structures fcntl: allow to set O_DIRECT flag on pipe fs: __generic_file_splice_read retry lookup on AOP_TRUNCATED_PAGE fs: xattr: Use kvfree() [s390] page_to_phys() always returns a multiple of PAGE_SIZE nbd: use ->compat_ioctl() fs: use block_device name vsprintf helper lib/vsprintf: add %*pg format specifier fs: use gendisk->disk_name where possible poll: plug an unused argument to do_poll amdkfd: don't open-code memdup_user() cdrom: don't open-code memdup_user() rsxx: don't open-code memdup_user() mtip32xx: don't open-code memdup_user() [um] mconsole: don't open-code memdup_user_nul() [um] hostaudio: don't open-code memdup_user() ...
This commit is contained in:
commit
33caf82acf
@ -250,6 +250,12 @@ dentry names:
|
|||||||
|
|
||||||
Passed by reference.
|
Passed by reference.
|
||||||
|
|
||||||
|
block_device names:
|
||||||
|
|
||||||
|
%pg sda, sda1 or loop0p1
|
||||||
|
|
||||||
|
For printing name of block_device pointers.
|
||||||
|
|
||||||
struct va_format:
|
struct va_format:
|
||||||
|
|
||||||
%pV
|
%pV
|
||||||
|
@ -168,12 +168,6 @@ static inline int bad_user_access_length(void)
|
|||||||
#define __copy_to_user_inatomic __copy_to_user
|
#define __copy_to_user_inatomic __copy_to_user
|
||||||
#define __copy_from_user_inatomic __copy_from_user
|
#define __copy_from_user_inatomic __copy_from_user
|
||||||
|
|
||||||
#define copy_to_user_ret(to, from, n, retval) ({ if (copy_to_user(to, from, n))\
|
|
||||||
return retval; })
|
|
||||||
|
|
||||||
#define copy_from_user_ret(to, from, n, retval) ({ if (copy_from_user(to, from, n))\
|
|
||||||
return retval; })
|
|
||||||
|
|
||||||
static inline unsigned long __must_check
|
static inline unsigned long __must_check
|
||||||
copy_from_user(void *to, const void __user *from, unsigned long n)
|
copy_from_user(void *to, const void __user *from, unsigned long n)
|
||||||
{
|
{
|
||||||
|
@ -135,10 +135,6 @@ extern int __get_user_bad(void);
|
|||||||
#define __copy_to_user_inatomic __copy_to_user
|
#define __copy_to_user_inatomic __copy_to_user
|
||||||
#define __copy_from_user_inatomic __copy_from_user
|
#define __copy_from_user_inatomic __copy_from_user
|
||||||
|
|
||||||
#define copy_to_user_ret(to,from,n,retval) ({ if (copy_to_user(to,from,n)) return retval; })
|
|
||||||
|
|
||||||
#define copy_from_user_ret(to,from,n,retval) ({ if (copy_from_user(to,from,n)) return retval; })
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copy a null terminated string from userspace.
|
* Copy a null terminated string from userspace.
|
||||||
*/
|
*/
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
static DEFINE_MUTEX(pvc_mutex);
|
static DEFINE_MUTEX(pvc_mutex);
|
||||||
static char pvc_lines[PVC_NLINES][PVC_LINELEN+1];
|
static char pvc_lines[PVC_NLINES][PVC_LINELEN+1];
|
||||||
static int pvc_linedata[PVC_NLINES];
|
static int pvc_linedata[PVC_NLINES];
|
||||||
static struct proc_dir_entry *pvc_display_dir;
|
|
||||||
static char *pvc_linename[PVC_NLINES] = {"line1", "line2"};
|
static char *pvc_linename[PVC_NLINES] = {"line1", "line2"};
|
||||||
#define DISPLAY_DIR_NAME "display"
|
#define DISPLAY_DIR_NAME "display"
|
||||||
static int scroll_dir, scroll_interval;
|
static int scroll_dir, scroll_interval;
|
||||||
@ -169,22 +168,17 @@ void pvc_proc_timerfunc(unsigned long data)
|
|||||||
|
|
||||||
static void pvc_proc_cleanup(void)
|
static void pvc_proc_cleanup(void)
|
||||||
{
|
{
|
||||||
int i;
|
remove_proc_subtree(DISPLAY_DIR_NAME, NULL);
|
||||||
for (i = 0; i < PVC_NLINES; i++)
|
|
||||||
remove_proc_entry(pvc_linename[i], pvc_display_dir);
|
|
||||||
remove_proc_entry("scroll", pvc_display_dir);
|
|
||||||
remove_proc_entry(DISPLAY_DIR_NAME, NULL);
|
|
||||||
|
|
||||||
del_timer_sync(&timer);
|
del_timer_sync(&timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init pvc_proc_init(void)
|
static int __init pvc_proc_init(void)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *proc_entry;
|
struct proc_dir_entry *dir, *proc_entry;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
pvc_display_dir = proc_mkdir(DISPLAY_DIR_NAME, NULL);
|
dir = proc_mkdir(DISPLAY_DIR_NAME, NULL);
|
||||||
if (pvc_display_dir == NULL)
|
if (dir == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
for (i = 0; i < PVC_NLINES; i++) {
|
for (i = 0; i < PVC_NLINES; i++) {
|
||||||
@ -192,12 +186,12 @@ static int __init pvc_proc_init(void)
|
|||||||
pvc_linedata[i] = i;
|
pvc_linedata[i] = i;
|
||||||
}
|
}
|
||||||
for (i = 0; i < PVC_NLINES; i++) {
|
for (i = 0; i < PVC_NLINES; i++) {
|
||||||
proc_entry = proc_create_data(pvc_linename[i], 0644, pvc_display_dir,
|
proc_entry = proc_create_data(pvc_linename[i], 0644, dir,
|
||||||
&pvc_line_proc_fops, &pvc_linedata[i]);
|
&pvc_line_proc_fops, &pvc_linedata[i]);
|
||||||
if (proc_entry == NULL)
|
if (proc_entry == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
proc_entry = proc_create("scroll", 0644, pvc_display_dir,
|
proc_entry = proc_create("scroll", 0644, dir,
|
||||||
&pvc_scroll_proc_fops);
|
&pvc_scroll_proc_fops);
|
||||||
if (proc_entry == NULL)
|
if (proc_entry == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -110,21 +110,6 @@ extern int fixup_exception(struct pt_regs *regs);
|
|||||||
#define __put_user(x, ptr) __put_user_nocheck((x), (ptr), sizeof(*(ptr)))
|
#define __put_user(x, ptr) __put_user_nocheck((x), (ptr), sizeof(*(ptr)))
|
||||||
#define __get_user(x, ptr) __get_user_nocheck((x), (ptr), sizeof(*(ptr)))
|
#define __get_user(x, ptr) __get_user_nocheck((x), (ptr), sizeof(*(ptr)))
|
||||||
|
|
||||||
/*
|
|
||||||
* The "xxx_ret" versions return constant specified in third argument, if
|
|
||||||
* something bad happens. These macros can be optimized for the
|
|
||||||
* case of just returning from the function xxx_ret is used.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define put_user_ret(x, ptr, ret) \
|
|
||||||
({ if (put_user((x), (ptr))) return (ret); })
|
|
||||||
#define get_user_ret(x, ptr, ret) \
|
|
||||||
({ if (get_user((x), (ptr))) return (ret); })
|
|
||||||
#define __put_user_ret(x, ptr, ret) \
|
|
||||||
({ if (__put_user((x), (ptr))) return (ret); })
|
|
||||||
#define __get_user_ret(x, ptr, ret) \
|
|
||||||
({ if (__get_user((x), (ptr))) return (ret); })
|
|
||||||
|
|
||||||
struct __large_struct { unsigned long buf[100]; };
|
struct __large_struct { unsigned long buf[100]; };
|
||||||
#define __m(x) (*(struct __large_struct *)(x))
|
#define __m(x) (*(struct __large_struct *)(x))
|
||||||
|
|
||||||
|
@ -274,21 +274,6 @@ do { \
|
|||||||
__gu_err; \
|
__gu_err; \
|
||||||
})
|
})
|
||||||
|
|
||||||
#ifndef __powerpc64__
|
|
||||||
#define __get_user64_nocheck(x, ptr, size) \
|
|
||||||
({ \
|
|
||||||
long __gu_err; \
|
|
||||||
long long __gu_val; \
|
|
||||||
__typeof__(*(ptr)) __user *__gu_addr = (ptr); \
|
|
||||||
__chk_user_ptr(ptr); \
|
|
||||||
if (!is_kernel_addr((unsigned long)__gu_addr)) \
|
|
||||||
might_fault(); \
|
|
||||||
__get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
|
|
||||||
(x) = (__force __typeof__(*(ptr)))__gu_val; \
|
|
||||||
__gu_err; \
|
|
||||||
})
|
|
||||||
#endif /* __powerpc64__ */
|
|
||||||
|
|
||||||
#define __get_user_check(x, ptr, size) \
|
#define __get_user_check(x, ptr, size) \
|
||||||
({ \
|
({ \
|
||||||
long __gu_err = -EFAULT; \
|
long __gu_err = -EFAULT; \
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/spinlock.h>
|
#include <linux/spinlock.h>
|
||||||
#include <linux/kmsg_dump.h>
|
#include <linux/kmsg_dump.h>
|
||||||
|
#include <linux/pagemap.h>
|
||||||
#include <linux/pstore.h>
|
#include <linux/pstore.h>
|
||||||
#include <linux/zlib.h>
|
#include <linux/zlib.h>
|
||||||
#include <asm/uaccess.h>
|
#include <asm/uaccess.h>
|
||||||
@ -733,24 +734,10 @@ static void oops_to_nvram(struct kmsg_dumper *dumper,
|
|||||||
|
|
||||||
static loff_t dev_nvram_llseek(struct file *file, loff_t offset, int origin)
|
static loff_t dev_nvram_llseek(struct file *file, loff_t offset, int origin)
|
||||||
{
|
{
|
||||||
int size;
|
|
||||||
|
|
||||||
if (ppc_md.nvram_size == NULL)
|
if (ppc_md.nvram_size == NULL)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
size = ppc_md.nvram_size();
|
return generic_file_llseek_size(file, offset, origin, MAX_LFS_FILESIZE,
|
||||||
|
ppc_md.nvram_size());
|
||||||
switch (origin) {
|
|
||||||
case 1:
|
|
||||||
offset += file->f_pos;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
offset += size;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (offset < 0)
|
|
||||||
return -EINVAL;
|
|
||||||
file->f_pos = offset;
|
|
||||||
return file->f_pos;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -366,8 +366,7 @@ static void *s390_dma_alloc(struct device *dev, size_t size,
|
|||||||
pa = page_to_phys(page);
|
pa = page_to_phys(page);
|
||||||
memset((void *) pa, 0, size);
|
memset((void *) pa, 0, size);
|
||||||
|
|
||||||
map = s390_dma_map_pages(dev, page, pa % PAGE_SIZE,
|
map = s390_dma_map_pages(dev, page, 0, size, DMA_BIDIRECTIONAL, NULL);
|
||||||
size, DMA_BIDIRECTIONAL, NULL);
|
|
||||||
if (dma_mapping_error(dev, map)) {
|
if (dma_mapping_error(dev, map)) {
|
||||||
free_pages(pa, get_order(size));
|
free_pages(pa, get_order(size));
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -205,31 +205,6 @@ int __put_user_bad(void);
|
|||||||
__gu_ret; \
|
__gu_ret; \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define __get_user_check_ret(x, addr, size, type, retval) ({ \
|
|
||||||
register unsigned long __gu_val __asm__ ("l1"); \
|
|
||||||
if (__access_ok(addr, size)) { \
|
|
||||||
switch (size) { \
|
|
||||||
case 1: \
|
|
||||||
__get_user_asm_ret(__gu_val, ub, addr, retval); \
|
|
||||||
break; \
|
|
||||||
case 2: \
|
|
||||||
__get_user_asm_ret(__gu_val, uh, addr, retval); \
|
|
||||||
break; \
|
|
||||||
case 4: \
|
|
||||||
__get_user_asm_ret(__gu_val, , addr, retval); \
|
|
||||||
break; \
|
|
||||||
case 8: \
|
|
||||||
__get_user_asm_ret(__gu_val, d, addr, retval); \
|
|
||||||
break; \
|
|
||||||
default: \
|
|
||||||
if (__get_user_bad()) \
|
|
||||||
return retval; \
|
|
||||||
} \
|
|
||||||
x = (__force type) __gu_val; \
|
|
||||||
} else \
|
|
||||||
return retval; \
|
|
||||||
})
|
|
||||||
|
|
||||||
#define __get_user_nocheck(x, addr, size, type) ({ \
|
#define __get_user_nocheck(x, addr, size, type) ({ \
|
||||||
register int __gu_ret; \
|
register int __gu_ret; \
|
||||||
register unsigned long __gu_val; \
|
register unsigned long __gu_val; \
|
||||||
@ -247,20 +222,6 @@ int __put_user_bad(void);
|
|||||||
__gu_ret; \
|
__gu_ret; \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define __get_user_nocheck_ret(x, addr, size, type, retval) ({ \
|
|
||||||
register unsigned long __gu_val __asm__ ("l1"); \
|
|
||||||
switch (size) { \
|
|
||||||
case 1: __get_user_asm_ret(__gu_val, ub, addr, retval); break; \
|
|
||||||
case 2: __get_user_asm_ret(__gu_val, uh, addr, retval); break; \
|
|
||||||
case 4: __get_user_asm_ret(__gu_val, , addr, retval); break; \
|
|
||||||
case 8: __get_user_asm_ret(__gu_val, d, addr, retval); break; \
|
|
||||||
default: \
|
|
||||||
if (__get_user_bad()) \
|
|
||||||
return retval; \
|
|
||||||
} \
|
|
||||||
x = (__force type) __gu_val; \
|
|
||||||
})
|
|
||||||
|
|
||||||
#define __get_user_asm(x, size, addr, ret) \
|
#define __get_user_asm(x, size, addr, ret) \
|
||||||
__asm__ __volatile__( \
|
__asm__ __volatile__( \
|
||||||
"/* Get user asm, inline. */\n" \
|
"/* Get user asm, inline. */\n" \
|
||||||
@ -281,32 +242,6 @@ __asm__ __volatile__( \
|
|||||||
: "=&r" (ret), "=&r" (x) : "m" (*__m(addr)), \
|
: "=&r" (ret), "=&r" (x) : "m" (*__m(addr)), \
|
||||||
"i" (-EFAULT))
|
"i" (-EFAULT))
|
||||||
|
|
||||||
#define __get_user_asm_ret(x, size, addr, retval) \
|
|
||||||
if (__builtin_constant_p(retval) && retval == -EFAULT) \
|
|
||||||
__asm__ __volatile__( \
|
|
||||||
"/* Get user asm ret, inline. */\n" \
|
|
||||||
"1:\t" "ld"#size " %1, %0\n\n\t" \
|
|
||||||
".section __ex_table,#alloc\n\t" \
|
|
||||||
".align 4\n\t" \
|
|
||||||
".word 1b,__ret_efault\n\n\t" \
|
|
||||||
".previous\n\t" \
|
|
||||||
: "=&r" (x) : "m" (*__m(addr))); \
|
|
||||||
else \
|
|
||||||
__asm__ __volatile__( \
|
|
||||||
"/* Get user asm ret, inline. */\n" \
|
|
||||||
"1:\t" "ld"#size " %1, %0\n\n\t" \
|
|
||||||
".section .fixup,#alloc,#execinstr\n\t" \
|
|
||||||
".align 4\n" \
|
|
||||||
"3:\n\t" \
|
|
||||||
"ret\n\t" \
|
|
||||||
" restore %%g0, %2, %%o0\n\n\t" \
|
|
||||||
".previous\n\t" \
|
|
||||||
".section __ex_table,#alloc\n\t" \
|
|
||||||
".align 4\n\t" \
|
|
||||||
".word 1b, 3b\n\n\t" \
|
|
||||||
".previous\n\t" \
|
|
||||||
: "=&r" (x) : "m" (*__m(addr)), "i" (retval))
|
|
||||||
|
|
||||||
int __get_user_bad(void);
|
int __get_user_bad(void);
|
||||||
|
|
||||||
unsigned long __copy_user(void __user *to, const void __user *from, unsigned long size);
|
unsigned long __copy_user(void __user *to, const void __user *from, unsigned long size);
|
||||||
|
@ -179,20 +179,6 @@ int __put_user_bad(void);
|
|||||||
__gu_ret; \
|
__gu_ret; \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define __get_user_nocheck_ret(data, addr, size, type, retval) ({ \
|
|
||||||
register unsigned long __gu_val __asm__ ("l1"); \
|
|
||||||
switch (size) { \
|
|
||||||
case 1: __get_user_asm_ret(__gu_val, ub, addr, retval); break; \
|
|
||||||
case 2: __get_user_asm_ret(__gu_val, uh, addr, retval); break; \
|
|
||||||
case 4: __get_user_asm_ret(__gu_val, uw, addr, retval); break; \
|
|
||||||
case 8: __get_user_asm_ret(__gu_val, x, addr, retval); break; \
|
|
||||||
default: \
|
|
||||||
if (__get_user_bad()) \
|
|
||||||
return retval; \
|
|
||||||
} \
|
|
||||||
data = (__force type) __gu_val; \
|
|
||||||
})
|
|
||||||
|
|
||||||
#define __get_user_asm(x, size, addr, ret) \
|
#define __get_user_asm(x, size, addr, ret) \
|
||||||
__asm__ __volatile__( \
|
__asm__ __volatile__( \
|
||||||
"/* Get user asm, inline. */\n" \
|
"/* Get user asm, inline. */\n" \
|
||||||
@ -214,32 +200,6 @@ __asm__ __volatile__( \
|
|||||||
: "=r" (ret), "=r" (x) : "r" (__m(addr)), \
|
: "=r" (ret), "=r" (x) : "r" (__m(addr)), \
|
||||||
"i" (-EFAULT))
|
"i" (-EFAULT))
|
||||||
|
|
||||||
#define __get_user_asm_ret(x, size, addr, retval) \
|
|
||||||
if (__builtin_constant_p(retval) && retval == -EFAULT) \
|
|
||||||
__asm__ __volatile__( \
|
|
||||||
"/* Get user asm ret, inline. */\n" \
|
|
||||||
"1:\t" "ld"#size "a [%1] %%asi, %0\n\n\t" \
|
|
||||||
".section __ex_table,\"a\"\n\t" \
|
|
||||||
".align 4\n\t" \
|
|
||||||
".word 1b,__ret_efault\n\n\t" \
|
|
||||||
".previous\n\t" \
|
|
||||||
: "=r" (x) : "r" (__m(addr))); \
|
|
||||||
else \
|
|
||||||
__asm__ __volatile__( \
|
|
||||||
"/* Get user asm ret, inline. */\n" \
|
|
||||||
"1:\t" "ld"#size "a [%1] %%asi, %0\n\n\t" \
|
|
||||||
".section .fixup,#alloc,#execinstr\n\t" \
|
|
||||||
".align 4\n" \
|
|
||||||
"3:\n\t" \
|
|
||||||
"ret\n\t" \
|
|
||||||
" restore %%g0, %2, %%o0\n\n\t" \
|
|
||||||
".previous\n\t" \
|
|
||||||
".section __ex_table,\"a\"\n\t" \
|
|
||||||
".align 4\n\t" \
|
|
||||||
".word 1b, 3b\n\n\t" \
|
|
||||||
".previous\n\t" \
|
|
||||||
: "=r" (x) : "r" (__m(addr)), "i" (retval))
|
|
||||||
|
|
||||||
int __get_user_bad(void);
|
int __get_user_bad(void);
|
||||||
|
|
||||||
unsigned long __must_check ___copy_from_user(void *to,
|
unsigned long __must_check ___copy_from_user(void *to,
|
||||||
|
@ -1033,25 +1033,9 @@ static ssize_t mdesc_read(struct file *file, char __user *buf,
|
|||||||
|
|
||||||
static loff_t mdesc_llseek(struct file *file, loff_t offset, int whence)
|
static loff_t mdesc_llseek(struct file *file, loff_t offset, int whence)
|
||||||
{
|
{
|
||||||
struct mdesc_handle *hp;
|
struct mdesc_handle *hp = file->private_data;
|
||||||
|
|
||||||
switch (whence) {
|
return no_seek_end_llseek_size(file, offset, whence, hp->handle_size);
|
||||||
case SEEK_CUR:
|
|
||||||
offset += file->f_pos;
|
|
||||||
break;
|
|
||||||
case SEEK_SET:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
hp = file->private_data;
|
|
||||||
if (offset > hp->handle_size)
|
|
||||||
return -EINVAL;
|
|
||||||
else
|
|
||||||
file->f_pos = offset;
|
|
||||||
|
|
||||||
return offset;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* mdesc_close() - /dev/mdesc is being closed, release the reference to
|
/* mdesc_close() - /dev/mdesc is being closed, release the reference to
|
||||||
|
@ -105,13 +105,9 @@ static ssize_t hostaudio_write(struct file *file, const char __user *buffer,
|
|||||||
printk(KERN_DEBUG "hostaudio: write called, count = %d\n", count);
|
printk(KERN_DEBUG "hostaudio: write called, count = %d\n", count);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
kbuf = kmalloc(count, GFP_KERNEL);
|
kbuf = memdup_user(buffer, count);
|
||||||
if (kbuf == NULL)
|
if (IS_ERR(kbuf))
|
||||||
return -ENOMEM;
|
return PTR_ERR(kbuf);
|
||||||
|
|
||||||
err = -EFAULT;
|
|
||||||
if (copy_from_user(kbuf, buffer, count))
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
err = os_write_file(state->fd, kbuf, count);
|
err = os_write_file(state->fd, kbuf, count);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
|
@ -748,19 +748,11 @@ static ssize_t mconsole_proc_write(struct file *file,
|
|||||||
{
|
{
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
buf = kmalloc(count + 1, GFP_KERNEL);
|
buf = memdup_user_nul(buffer, count);
|
||||||
if (buf == NULL)
|
if (IS_ERR(buf))
|
||||||
return -ENOMEM;
|
return PTR_ERR(buf);
|
||||||
|
|
||||||
if (copy_from_user(buf, buffer, count)) {
|
|
||||||
count = -EFAULT;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
buf[count] = '\0';
|
|
||||||
|
|
||||||
mconsole_notify(notify_socket, MCONSOLE_USER_NOTIFY, buf, count);
|
mconsole_notify(notify_socket, MCONSOLE_USER_NOTIFY, buf, count);
|
||||||
out:
|
|
||||||
kfree(buf);
|
kfree(buf);
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
@ -58,28 +58,6 @@ static void cpuid_smp_cpuid(void *cmd_block)
|
|||||||
&cmd->eax, &cmd->ebx, &cmd->ecx, &cmd->edx);
|
&cmd->eax, &cmd->ebx, &cmd->ecx, &cmd->edx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static loff_t cpuid_seek(struct file *file, loff_t offset, int orig)
|
|
||||||
{
|
|
||||||
loff_t ret;
|
|
||||||
struct inode *inode = file->f_mapping->host;
|
|
||||||
|
|
||||||
mutex_lock(&inode->i_mutex);
|
|
||||||
switch (orig) {
|
|
||||||
case 0:
|
|
||||||
file->f_pos = offset;
|
|
||||||
ret = file->f_pos;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
file->f_pos += offset;
|
|
||||||
ret = file->f_pos;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
ret = -EINVAL;
|
|
||||||
}
|
|
||||||
mutex_unlock(&inode->i_mutex);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ssize_t cpuid_read(struct file *file, char __user *buf,
|
static ssize_t cpuid_read(struct file *file, char __user *buf,
|
||||||
size_t count, loff_t *ppos)
|
size_t count, loff_t *ppos)
|
||||||
{
|
{
|
||||||
@ -132,7 +110,7 @@ static int cpuid_open(struct inode *inode, struct file *file)
|
|||||||
*/
|
*/
|
||||||
static const struct file_operations cpuid_fops = {
|
static const struct file_operations cpuid_fops = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.llseek = cpuid_seek,
|
.llseek = no_seek_end_llseek,
|
||||||
.read = cpuid_read,
|
.read = cpuid_read,
|
||||||
.open = cpuid_open,
|
.open = cpuid_open,
|
||||||
};
|
};
|
||||||
|
@ -45,28 +45,6 @@
|
|||||||
|
|
||||||
static struct class *msr_class;
|
static struct class *msr_class;
|
||||||
|
|
||||||
static loff_t msr_seek(struct file *file, loff_t offset, int orig)
|
|
||||||
{
|
|
||||||
loff_t ret;
|
|
||||||
struct inode *inode = file_inode(file);
|
|
||||||
|
|
||||||
mutex_lock(&inode->i_mutex);
|
|
||||||
switch (orig) {
|
|
||||||
case SEEK_SET:
|
|
||||||
file->f_pos = offset;
|
|
||||||
ret = file->f_pos;
|
|
||||||
break;
|
|
||||||
case SEEK_CUR:
|
|
||||||
file->f_pos += offset;
|
|
||||||
ret = file->f_pos;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
ret = -EINVAL;
|
|
||||||
}
|
|
||||||
mutex_unlock(&inode->i_mutex);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ssize_t msr_read(struct file *file, char __user *buf,
|
static ssize_t msr_read(struct file *file, char __user *buf,
|
||||||
size_t count, loff_t *ppos)
|
size_t count, loff_t *ppos)
|
||||||
{
|
{
|
||||||
@ -194,7 +172,7 @@ static int msr_open(struct inode *inode, struct file *file)
|
|||||||
*/
|
*/
|
||||||
static const struct file_operations msr_fops = {
|
static const struct file_operations msr_fops = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.llseek = msr_seek,
|
.llseek = no_seek_end_llseek,
|
||||||
.read = msr_read,
|
.read = msr_read,
|
||||||
.write = msr_write,
|
.write = msr_write,
|
||||||
.open = msr_open,
|
.open = msr_open,
|
||||||
|
@ -227,16 +227,12 @@ static ssize_t proc_read_simdisk(struct file *file, char __user *buf,
|
|||||||
static ssize_t proc_write_simdisk(struct file *file, const char __user *buf,
|
static ssize_t proc_write_simdisk(struct file *file, const char __user *buf,
|
||||||
size_t count, loff_t *ppos)
|
size_t count, loff_t *ppos)
|
||||||
{
|
{
|
||||||
char *tmp = kmalloc(count + 1, GFP_KERNEL);
|
char *tmp = memdup_user_nul(buf, count);
|
||||||
struct simdisk *dev = PDE_DATA(file_inode(file));
|
struct simdisk *dev = PDE_DATA(file_inode(file));
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (tmp == NULL)
|
if (IS_ERR(tmp))
|
||||||
return -ENOMEM;
|
return PTR_ERR(tmp);
|
||||||
if (copy_from_user(tmp, buf, count)) {
|
|
||||||
err = -EFAULT;
|
|
||||||
goto out_free;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = simdisk_detach(dev);
|
err = simdisk_detach(dev);
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
@ -244,8 +240,6 @@ static ssize_t proc_write_simdisk(struct file *file, const char __user *buf,
|
|||||||
|
|
||||||
if (count > 0 && tmp[count - 1] == '\n')
|
if (count > 0 && tmp[count - 1] == '\n')
|
||||||
tmp[count - 1] = 0;
|
tmp[count - 1] = 0;
|
||||||
else
|
|
||||||
tmp[count] = 0;
|
|
||||||
|
|
||||||
if (tmp[0])
|
if (tmp[0])
|
||||||
err = simdisk_attach(dev, tmp);
|
err = simdisk_attach(dev, tmp);
|
||||||
|
@ -514,14 +514,9 @@ cciss_proc_write(struct file *file, const char __user *buf,
|
|||||||
if (!buf || length > PAGE_SIZE - 1)
|
if (!buf || length > PAGE_SIZE - 1)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
buffer = (char *)__get_free_page(GFP_KERNEL);
|
buffer = memdup_user_nul(buf, length);
|
||||||
if (!buffer)
|
if (IS_ERR(buffer))
|
||||||
return -ENOMEM;
|
return PTR_ERR(buffer);
|
||||||
|
|
||||||
err = -EFAULT;
|
|
||||||
if (copy_from_user(buffer, buf, length))
|
|
||||||
goto out;
|
|
||||||
buffer[length] = '\0';
|
|
||||||
|
|
||||||
#ifdef CONFIG_CISS_SCSI_TAPE
|
#ifdef CONFIG_CISS_SCSI_TAPE
|
||||||
if (strncmp(ENGAGE_SCSI, buffer, sizeof ENGAGE_SCSI - 1) == 0) {
|
if (strncmp(ENGAGE_SCSI, buffer, sizeof ENGAGE_SCSI - 1) == 0) {
|
||||||
@ -537,8 +532,7 @@ cciss_proc_write(struct file *file, const char __user *buf,
|
|||||||
/* might be nice to have "disengage" too, but it's not
|
/* might be nice to have "disengage" too, but it's not
|
||||||
safely possible. (only 1 module use count, lock issues.) */
|
safely possible. (only 1 module use count, lock issues.) */
|
||||||
|
|
||||||
out:
|
kfree(buffer);
|
||||||
free_page((unsigned long)buffer);
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2029,13 +2029,10 @@ static int exec_drive_taskfile(struct driver_data *dd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (taskout) {
|
if (taskout) {
|
||||||
outbuf = kzalloc(taskout, GFP_KERNEL);
|
outbuf = memdup_user(buf + outtotal, taskout);
|
||||||
if (outbuf == NULL) {
|
if (IS_ERR(outbuf)) {
|
||||||
err = -ENOMEM;
|
err = PTR_ERR(outbuf);
|
||||||
goto abort;
|
outbuf = NULL;
|
||||||
}
|
|
||||||
if (copy_from_user(outbuf, buf + outtotal, taskout)) {
|
|
||||||
err = -EFAULT;
|
|
||||||
goto abort;
|
goto abort;
|
||||||
}
|
}
|
||||||
outbuf_dma = pci_map_single(dd->pdev,
|
outbuf_dma = pci_map_single(dd->pdev,
|
||||||
@ -2050,14 +2047,10 @@ static int exec_drive_taskfile(struct driver_data *dd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (taskin) {
|
if (taskin) {
|
||||||
inbuf = kzalloc(taskin, GFP_KERNEL);
|
inbuf = memdup_user(buf + intotal, taskin);
|
||||||
if (inbuf == NULL) {
|
if (IS_ERR(inbuf)) {
|
||||||
err = -ENOMEM;
|
err = PTR_ERR(inbuf);
|
||||||
goto abort;
|
inbuf = NULL;
|
||||||
}
|
|
||||||
|
|
||||||
if (copy_from_user(inbuf, buf + intotal, taskin)) {
|
|
||||||
err = -EFAULT;
|
|
||||||
goto abort;
|
goto abort;
|
||||||
}
|
}
|
||||||
inbuf_dma = pci_map_single(dd->pdev,
|
inbuf_dma = pci_map_single(dd->pdev,
|
||||||
|
@ -827,6 +827,7 @@ static const struct block_device_operations nbd_fops =
|
|||||||
{
|
{
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.ioctl = nbd_ioctl,
|
.ioctl = nbd_ioctl,
|
||||||
|
.compat_ioctl = nbd_ioctl,
|
||||||
};
|
};
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_DEBUG_FS)
|
#if IS_ENABLED(CONFIG_DEBUG_FS)
|
||||||
|
@ -203,14 +203,11 @@ static ssize_t rsxx_cram_write(struct file *fp, const char __user *ubuf,
|
|||||||
char *buf;
|
char *buf;
|
||||||
ssize_t st;
|
ssize_t st;
|
||||||
|
|
||||||
buf = kzalloc(cnt, GFP_KERNEL);
|
buf = memdup_user(ubuf, cnt);
|
||||||
if (!buf)
|
if (IS_ERR(buf))
|
||||||
return -ENOMEM;
|
return PTR_ERR(buf);
|
||||||
|
|
||||||
st = copy_from_user(buf, ubuf, cnt);
|
st = rsxx_creg_write(card, CREG_ADD_CRAM + (u32)*ppos, cnt, buf, 1);
|
||||||
if (!st)
|
|
||||||
st = rsxx_creg_write(card, CREG_ADD_CRAM + (u32)*ppos, cnt,
|
|
||||||
buf, 1);
|
|
||||||
kfree(buf);
|
kfree(buf);
|
||||||
if (st)
|
if (st)
|
||||||
return st;
|
return st;
|
||||||
|
@ -3186,15 +3186,11 @@ static noinline int mmc_ioctl_dvd_read_struct(struct cdrom_device_info *cdi,
|
|||||||
if (!CDROM_CAN(CDC_DVD))
|
if (!CDROM_CAN(CDC_DVD))
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
|
|
||||||
s = kmalloc(size, GFP_KERNEL);
|
s = memdup_user(arg, size);
|
||||||
if (!s)
|
if (IS_ERR(s))
|
||||||
return -ENOMEM;
|
return PTR_ERR(s);
|
||||||
|
|
||||||
cd_dbg(CD_DO_IOCTL, "entering DVD_READ_STRUCT\n");
|
cd_dbg(CD_DO_IOCTL, "entering DVD_READ_STRUCT\n");
|
||||||
if (copy_from_user(s, arg, size)) {
|
|
||||||
kfree(s);
|
|
||||||
return -EFAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = dvd_read_struct(cdi, s, cgc);
|
ret = dvd_read_struct(cdi, s, cgc);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <linux/fcntl.h>
|
#include <linux/fcntl.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/mutex.h>
|
#include <linux/mutex.h>
|
||||||
|
#include <linux/pagemap.h>
|
||||||
#include <asm/uaccess.h>
|
#include <asm/uaccess.h>
|
||||||
#include <asm/nvram.h>
|
#include <asm/nvram.h>
|
||||||
#ifdef CONFIG_PPC_PMAC
|
#ifdef CONFIG_PPC_PMAC
|
||||||
@ -33,24 +34,8 @@ static ssize_t nvram_len;
|
|||||||
|
|
||||||
static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
|
static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
|
||||||
{
|
{
|
||||||
switch (origin) {
|
return generic_file_llseek_size(file, offset, origin,
|
||||||
case 0:
|
MAX_LFS_FILESIZE, nvram_len);
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
offset += file->f_pos;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
offset += nvram_len;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
offset = -1;
|
|
||||||
}
|
|
||||||
if (offset < 0)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
file->f_pos = offset;
|
|
||||||
|
|
||||||
return file->f_pos;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t read_nvram(struct file *file, char __user *buf,
|
static ssize_t read_nvram(struct file *file, char __user *buf,
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <linux/uio.h>
|
#include <linux/uio.h>
|
||||||
#include <linux/mutex.h>
|
#include <linux/mutex.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
|
#include <linux/pagemap.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
#include <asm/uaccess.h>
|
#include <asm/uaccess.h>
|
||||||
#include <asm/pgtable.h>
|
#include <asm/pgtable.h>
|
||||||
@ -451,31 +452,8 @@ mbcs_sram_write(struct file * fp, const char __user *buf, size_t len, loff_t * o
|
|||||||
|
|
||||||
static loff_t mbcs_sram_llseek(struct file * filp, loff_t off, int whence)
|
static loff_t mbcs_sram_llseek(struct file * filp, loff_t off, int whence)
|
||||||
{
|
{
|
||||||
loff_t newpos;
|
return generic_file_llseek_size(filp, off, whence, MAX_LFS_FILESIZE,
|
||||||
|
MBCS_SRAM_SIZE);
|
||||||
switch (whence) {
|
|
||||||
case SEEK_SET:
|
|
||||||
newpos = off;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SEEK_CUR:
|
|
||||||
newpos = filp->f_pos + off;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SEEK_END:
|
|
||||||
newpos = MBCS_SRAM_SIZE + off;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default: /* can't happen */
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newpos < 0)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
filp->f_pos = newpos;
|
|
||||||
|
|
||||||
return newpos;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint64_t mbcs_pioaddr(struct mbcs_soft *soft, uint64_t offset)
|
static uint64_t mbcs_pioaddr(struct mbcs_soft *soft, uint64_t offset)
|
||||||
|
@ -110,6 +110,7 @@
|
|||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
#include <linux/uaccess.h>
|
#include <linux/uaccess.h>
|
||||||
#include <linux/mutex.h>
|
#include <linux/mutex.h>
|
||||||
|
#include <linux/pagemap.h>
|
||||||
|
|
||||||
|
|
||||||
static DEFINE_MUTEX(nvram_mutex);
|
static DEFINE_MUTEX(nvram_mutex);
|
||||||
@ -213,21 +214,8 @@ void nvram_set_checksum(void)
|
|||||||
|
|
||||||
static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
|
static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
|
||||||
{
|
{
|
||||||
switch (origin) {
|
return generic_file_llseek_size(file, offset, origin, MAX_LFS_FILESIZE,
|
||||||
case 0:
|
NVRAM_BYTES);
|
||||||
/* nothing to do */
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
offset += file->f_pos;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
offset += NVRAM_BYTES;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (offset >= 0) ? (file->f_pos = offset) : -EINVAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t nvram_read(struct file *file, char __user *buf,
|
static ssize_t nvram_read(struct file *file, char __user *buf,
|
||||||
|
@ -277,36 +277,7 @@ static loff_t flash_llseek(struct file *file, loff_t offset, int orig)
|
|||||||
printk(KERN_DEBUG "flash_llseek: offset=0x%X, orig=0x%X.\n",
|
printk(KERN_DEBUG "flash_llseek: offset=0x%X, orig=0x%X.\n",
|
||||||
(unsigned int) offset, orig);
|
(unsigned int) offset, orig);
|
||||||
|
|
||||||
switch (orig) {
|
ret = no_seek_end_llseek_size(file, offset, orig, gbFlashSize);
|
||||||
case 0:
|
|
||||||
if (offset < 0) {
|
|
||||||
ret = -EINVAL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((unsigned int) offset > gbFlashSize) {
|
|
||||||
ret = -EINVAL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
file->f_pos = (unsigned int) offset;
|
|
||||||
ret = file->f_pos;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
if ((file->f_pos + offset) > gbFlashSize) {
|
|
||||||
ret = -EINVAL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if ((file->f_pos + offset) < 0) {
|
|
||||||
ret = -EINVAL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
file->f_pos += offset;
|
|
||||||
ret = file->f_pos;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
ret = -EINVAL;
|
|
||||||
}
|
|
||||||
mutex_unlock(&flash_mutex);
|
mutex_unlock(&flash_mutex);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -559,19 +559,10 @@ static int kfd_ioctl_dbg_address_watch(struct file *filep,
|
|||||||
|
|
||||||
/* this is the actual buffer to work with */
|
/* this is the actual buffer to work with */
|
||||||
|
|
||||||
args_buff = kmalloc(args->buf_size_in_bytes -
|
args_buff = memdup_user(args_buff,
|
||||||
sizeof(*args), GFP_KERNEL);
|
|
||||||
if (args_buff == NULL)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
status = copy_from_user(args_buff, cmd_from_user,
|
|
||||||
args->buf_size_in_bytes - sizeof(*args));
|
args->buf_size_in_bytes - sizeof(*args));
|
||||||
|
if (IS_ERR(args_buff))
|
||||||
if (status != 0) {
|
return PTR_ERR(args_buff);
|
||||||
pr_debug("Failed to copy address watch user data\n");
|
|
||||||
kfree(args_buff);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
aw_info.process = p;
|
aw_info.process = p;
|
||||||
|
|
||||||
@ -677,22 +668,12 @@ static int kfd_ioctl_dbg_wave_control(struct file *filep,
|
|||||||
if (cmd_from_user == NULL)
|
if (cmd_from_user == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* this is the actual buffer to work with */
|
/* copy the entire buffer from user */
|
||||||
|
|
||||||
args_buff = kmalloc(args->buf_size_in_bytes - sizeof(*args),
|
args_buff = memdup_user(cmd_from_user,
|
||||||
GFP_KERNEL);
|
|
||||||
|
|
||||||
if (args_buff == NULL)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
/* Now copy the entire buffer from user */
|
|
||||||
status = copy_from_user(args_buff, cmd_from_user,
|
|
||||||
args->buf_size_in_bytes - sizeof(*args));
|
args->buf_size_in_bytes - sizeof(*args));
|
||||||
if (status != 0) {
|
if (IS_ERR(args_buff))
|
||||||
pr_debug("Failed to copy wave control user data\n");
|
return PTR_ERR(args_buff);
|
||||||
kfree(args_buff);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* move ptr to the start of the "pay-load" area */
|
/* move ptr to the start of the "pay-load" area */
|
||||||
wac_info.process = p;
|
wac_info.process = p;
|
||||||
|
@ -1163,12 +1163,8 @@ static ssize_t vga_arb_write(struct file *file, const char __user *buf,
|
|||||||
|
|
||||||
static unsigned int vga_arb_fpoll(struct file *file, poll_table *wait)
|
static unsigned int vga_arb_fpoll(struct file *file, poll_table *wait)
|
||||||
{
|
{
|
||||||
struct vga_arb_private *priv = file->private_data;
|
|
||||||
|
|
||||||
pr_debug("%s\n", __func__);
|
pr_debug("%s\n", __func__);
|
||||||
|
|
||||||
if (priv == NULL)
|
|
||||||
return -ENODEV;
|
|
||||||
poll_wait(file, &vga_wait_queue, wait);
|
poll_wait(file, &vga_wait_queue, wait);
|
||||||
return POLLIN;
|
return POLLIN;
|
||||||
}
|
}
|
||||||
@ -1209,9 +1205,6 @@ static int vga_arb_release(struct inode *inode, struct file *file)
|
|||||||
|
|
||||||
pr_debug("%s\n", __func__);
|
pr_debug("%s\n", __func__);
|
||||||
|
|
||||||
if (priv == NULL)
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
spin_lock_irqsave(&vga_user_lock, flags);
|
spin_lock_irqsave(&vga_user_lock, flags);
|
||||||
list_del(&priv->list);
|
list_del(&priv->list);
|
||||||
for (i = 0; i < MAX_USER_CARDS; i++) {
|
for (i = 0; i < MAX_USER_CARDS; i++) {
|
||||||
|
@ -230,7 +230,7 @@ void bch_bio_map(struct bio *bio, void *base)
|
|||||||
BUG_ON(!bio->bi_iter.bi_size);
|
BUG_ON(!bio->bi_iter.bi_size);
|
||||||
BUG_ON(bio->bi_vcnt);
|
BUG_ON(bio->bi_vcnt);
|
||||||
|
|
||||||
bv->bv_offset = base ? ((unsigned long) base) % PAGE_SIZE : 0;
|
bv->bv_offset = base ? offset_in_page(base) : 0;
|
||||||
goto start;
|
goto start;
|
||||||
|
|
||||||
for (; size; bio->bi_vcnt++, bv++) {
|
for (; size; bio->bi_vcnt++, bv++) {
|
||||||
|
@ -650,7 +650,7 @@ static void use_inline_bio(struct dm_buffer *b, int rw, sector_t block,
|
|||||||
do {
|
do {
|
||||||
if (!bio_add_page(&b->bio, virt_to_page(ptr),
|
if (!bio_add_page(&b->bio, virt_to_page(ptr),
|
||||||
len < PAGE_SIZE ? len : PAGE_SIZE,
|
len < PAGE_SIZE ? len : PAGE_SIZE,
|
||||||
virt_to_phys(ptr) & (PAGE_SIZE - 1))) {
|
offset_in_page(ptr))) {
|
||||||
BUG_ON(b->c->block_size <= PAGE_SIZE);
|
BUG_ON(b->c->block_size <= PAGE_SIZE);
|
||||||
use_dmio(b, rw, block, end_io);
|
use_dmio(b, rw, block, end_io);
|
||||||
return;
|
return;
|
||||||
|
@ -246,7 +246,7 @@ static void vm_dp_init(struct dpages *dp, void *data)
|
|||||||
{
|
{
|
||||||
dp->get_page = vm_get_page;
|
dp->get_page = vm_get_page;
|
||||||
dp->next_page = vm_next_page;
|
dp->next_page = vm_next_page;
|
||||||
dp->context_u = ((unsigned long) data) & (PAGE_SIZE - 1);
|
dp->context_u = offset_in_page(data);
|
||||||
dp->context_ptr = data;
|
dp->context_ptr = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,7 +271,7 @@ static void km_dp_init(struct dpages *dp, void *data)
|
|||||||
{
|
{
|
||||||
dp->get_page = km_get_page;
|
dp->get_page = km_get_page;
|
||||||
dp->next_page = km_next_page;
|
dp->next_page = km_next_page;
|
||||||
dp->context_u = ((unsigned long) data) & (PAGE_SIZE - 1);
|
dp->context_u = offset_in_page(data);
|
||||||
dp->context_ptr = data;
|
dp->context_ptr = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
struct pcmciamtd_dev {
|
struct pcmciamtd_dev {
|
||||||
struct pcmcia_device *p_dev;
|
struct pcmcia_device *p_dev;
|
||||||
caddr_t win_base; /* ioremapped address of PCMCIA window */
|
void __iomem *win_base; /* ioremapped address of PCMCIA window */
|
||||||
unsigned int win_size; /* size of window */
|
unsigned int win_size; /* size of window */
|
||||||
unsigned int offset; /* offset into card the window currently points at */
|
unsigned int offset; /* offset into card the window currently points at */
|
||||||
struct map_info pcmcia_map;
|
struct map_info pcmcia_map;
|
||||||
@ -80,7 +80,7 @@ MODULE_PARM_DESC(mem_type, "Set Memory type (0=Flash, 1=RAM, 2=ROM, default=0)")
|
|||||||
/* read/write{8,16} copy_{from,to} routines with window remapping
|
/* read/write{8,16} copy_{from,to} routines with window remapping
|
||||||
* to access whole card
|
* to access whole card
|
||||||
*/
|
*/
|
||||||
static caddr_t remap_window(struct map_info *map, unsigned long to)
|
static void __iomem *remap_window(struct map_info *map, unsigned long to)
|
||||||
{
|
{
|
||||||
struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1;
|
struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1;
|
||||||
struct resource *win = (struct resource *) map->map_priv_2;
|
struct resource *win = (struct resource *) map->map_priv_2;
|
||||||
@ -107,7 +107,7 @@ static caddr_t remap_window(struct map_info *map, unsigned long to)
|
|||||||
|
|
||||||
static map_word pcmcia_read8_remap(struct map_info *map, unsigned long ofs)
|
static map_word pcmcia_read8_remap(struct map_info *map, unsigned long ofs)
|
||||||
{
|
{
|
||||||
caddr_t addr;
|
void __iomem *addr;
|
||||||
map_word d = {{0}};
|
map_word d = {{0}};
|
||||||
|
|
||||||
addr = remap_window(map, ofs);
|
addr = remap_window(map, ofs);
|
||||||
@ -122,7 +122,7 @@ static map_word pcmcia_read8_remap(struct map_info *map, unsigned long ofs)
|
|||||||
|
|
||||||
static map_word pcmcia_read16_remap(struct map_info *map, unsigned long ofs)
|
static map_word pcmcia_read16_remap(struct map_info *map, unsigned long ofs)
|
||||||
{
|
{
|
||||||
caddr_t addr;
|
void __iomem *addr;
|
||||||
map_word d = {{0}};
|
map_word d = {{0}};
|
||||||
|
|
||||||
addr = remap_window(map, ofs);
|
addr = remap_window(map, ofs);
|
||||||
@ -143,7 +143,7 @@ static void pcmcia_copy_from_remap(struct map_info *map, void *to, unsigned long
|
|||||||
pr_debug("to = %p from = %lu len = %zd\n", to, from, len);
|
pr_debug("to = %p from = %lu len = %zd\n", to, from, len);
|
||||||
while(len) {
|
while(len) {
|
||||||
int toread = win_size - (from & (win_size-1));
|
int toread = win_size - (from & (win_size-1));
|
||||||
caddr_t addr;
|
void __iomem *addr;
|
||||||
|
|
||||||
if(toread > len)
|
if(toread > len)
|
||||||
toread = len;
|
toread = len;
|
||||||
@ -163,7 +163,7 @@ static void pcmcia_copy_from_remap(struct map_info *map, void *to, unsigned long
|
|||||||
|
|
||||||
static void pcmcia_write8_remap(struct map_info *map, map_word d, unsigned long adr)
|
static void pcmcia_write8_remap(struct map_info *map, map_word d, unsigned long adr)
|
||||||
{
|
{
|
||||||
caddr_t addr = remap_window(map, adr);
|
void __iomem *addr = remap_window(map, adr);
|
||||||
|
|
||||||
if(!addr)
|
if(!addr)
|
||||||
return;
|
return;
|
||||||
@ -175,7 +175,7 @@ static void pcmcia_write8_remap(struct map_info *map, map_word d, unsigned long
|
|||||||
|
|
||||||
static void pcmcia_write16_remap(struct map_info *map, map_word d, unsigned long adr)
|
static void pcmcia_write16_remap(struct map_info *map, map_word d, unsigned long adr)
|
||||||
{
|
{
|
||||||
caddr_t addr = remap_window(map, adr);
|
void __iomem *addr = remap_window(map, adr);
|
||||||
if(!addr)
|
if(!addr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ static void pcmcia_copy_to_remap(struct map_info *map, unsigned long to, const v
|
|||||||
pr_debug("to = %lu from = %p len = %zd\n", to, from, len);
|
pr_debug("to = %lu from = %p len = %zd\n", to, from, len);
|
||||||
while(len) {
|
while(len) {
|
||||||
int towrite = win_size - (to & (win_size-1));
|
int towrite = win_size - (to & (win_size-1));
|
||||||
caddr_t addr;
|
void __iomem *addr;
|
||||||
|
|
||||||
if(towrite > len)
|
if(towrite > len)
|
||||||
towrite = len;
|
towrite = len;
|
||||||
@ -216,7 +216,7 @@ static void pcmcia_copy_to_remap(struct map_info *map, unsigned long to, const v
|
|||||||
|
|
||||||
static map_word pcmcia_read8(struct map_info *map, unsigned long ofs)
|
static map_word pcmcia_read8(struct map_info *map, unsigned long ofs)
|
||||||
{
|
{
|
||||||
caddr_t win_base = (caddr_t)map->map_priv_2;
|
void __iomem *win_base = (void __iomem *)map->map_priv_2;
|
||||||
map_word d = {{0}};
|
map_word d = {{0}};
|
||||||
|
|
||||||
if(DEV_REMOVED(map))
|
if(DEV_REMOVED(map))
|
||||||
@ -231,7 +231,7 @@ static map_word pcmcia_read8(struct map_info *map, unsigned long ofs)
|
|||||||
|
|
||||||
static map_word pcmcia_read16(struct map_info *map, unsigned long ofs)
|
static map_word pcmcia_read16(struct map_info *map, unsigned long ofs)
|
||||||
{
|
{
|
||||||
caddr_t win_base = (caddr_t)map->map_priv_2;
|
void __iomem *win_base = (void __iomem *)map->map_priv_2;
|
||||||
map_word d = {{0}};
|
map_word d = {{0}};
|
||||||
|
|
||||||
if(DEV_REMOVED(map))
|
if(DEV_REMOVED(map))
|
||||||
@ -246,7 +246,7 @@ static map_word pcmcia_read16(struct map_info *map, unsigned long ofs)
|
|||||||
|
|
||||||
static void pcmcia_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
|
static void pcmcia_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
|
||||||
{
|
{
|
||||||
caddr_t win_base = (caddr_t)map->map_priv_2;
|
void __iomem *win_base = (void __iomem *)map->map_priv_2;
|
||||||
|
|
||||||
if(DEV_REMOVED(map))
|
if(DEV_REMOVED(map))
|
||||||
return;
|
return;
|
||||||
@ -258,7 +258,7 @@ static void pcmcia_copy_from(struct map_info *map, void *to, unsigned long from,
|
|||||||
|
|
||||||
static void pcmcia_write8(struct map_info *map, map_word d, unsigned long adr)
|
static void pcmcia_write8(struct map_info *map, map_word d, unsigned long adr)
|
||||||
{
|
{
|
||||||
caddr_t win_base = (caddr_t)map->map_priv_2;
|
void __iomem *win_base = (void __iomem *)map->map_priv_2;
|
||||||
|
|
||||||
if(DEV_REMOVED(map))
|
if(DEV_REMOVED(map))
|
||||||
return;
|
return;
|
||||||
@ -271,7 +271,7 @@ static void pcmcia_write8(struct map_info *map, map_word d, unsigned long adr)
|
|||||||
|
|
||||||
static void pcmcia_write16(struct map_info *map, map_word d, unsigned long adr)
|
static void pcmcia_write16(struct map_info *map, map_word d, unsigned long adr)
|
||||||
{
|
{
|
||||||
caddr_t win_base = (caddr_t)map->map_priv_2;
|
void __iomem *win_base = (void __iomem *)map->map_priv_2;
|
||||||
|
|
||||||
if(DEV_REMOVED(map))
|
if(DEV_REMOVED(map))
|
||||||
return;
|
return;
|
||||||
@ -284,7 +284,7 @@ static void pcmcia_write16(struct map_info *map, map_word d, unsigned long adr)
|
|||||||
|
|
||||||
static void pcmcia_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
|
static void pcmcia_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
|
||||||
{
|
{
|
||||||
caddr_t win_base = (caddr_t)map->map_priv_2;
|
void __iomem *win_base = (void __iomem *)map->map_priv_2;
|
||||||
|
|
||||||
if(DEV_REMOVED(map))
|
if(DEV_REMOVED(map))
|
||||||
return;
|
return;
|
||||||
|
@ -580,16 +580,10 @@ static ssize_t wil_write_file_rxon(struct file *file, const char __user *buf,
|
|||||||
long channel;
|
long channel;
|
||||||
bool on;
|
bool on;
|
||||||
|
|
||||||
char *kbuf = kmalloc(len + 1, GFP_KERNEL);
|
char *kbuf = memdup_user_nul(buf, len);
|
||||||
|
|
||||||
if (!kbuf)
|
if (IS_ERR(kbuf))
|
||||||
return -ENOMEM;
|
return PTR_ERR(kbuf);
|
||||||
if (copy_from_user(kbuf, buf, len)) {
|
|
||||||
kfree(kbuf);
|
|
||||||
return -EIO;
|
|
||||||
}
|
|
||||||
|
|
||||||
kbuf[len] = '\0';
|
|
||||||
rc = kstrtol(kbuf, 0, &channel);
|
rc = kstrtol(kbuf, 0, &channel);
|
||||||
kfree(kbuf);
|
kfree(kbuf);
|
||||||
if (rc)
|
if (rc)
|
||||||
|
@ -56,19 +56,15 @@ static ssize_t lbs_sleepparams_write(struct file *file,
|
|||||||
loff_t *ppos)
|
loff_t *ppos)
|
||||||
{
|
{
|
||||||
struct lbs_private *priv = file->private_data;
|
struct lbs_private *priv = file->private_data;
|
||||||
ssize_t buf_size, ret;
|
ssize_t ret;
|
||||||
struct sleep_params sp;
|
struct sleep_params sp;
|
||||||
int p1, p2, p3, p4, p5, p6;
|
int p1, p2, p3, p4, p5, p6;
|
||||||
unsigned long addr = get_zeroed_page(GFP_KERNEL);
|
char *buf;
|
||||||
char *buf = (char *)addr;
|
|
||||||
if (!buf)
|
buf = memdup_user_nul(user_buf, min(count, len - 1));
|
||||||
return -ENOMEM;
|
if (IS_ERR(buf))
|
||||||
|
return PTR_ERR(buf);
|
||||||
|
|
||||||
buf_size = min(count, len - 1);
|
|
||||||
if (copy_from_user(buf, user_buf, buf_size)) {
|
|
||||||
ret = -EFAULT;
|
|
||||||
goto out_unlock;
|
|
||||||
}
|
|
||||||
ret = sscanf(buf, "%d %d %d %d %d %d", &p1, &p2, &p3, &p4, &p5, &p6);
|
ret = sscanf(buf, "%d %d %d %d %d %d", &p1, &p2, &p3, &p4, &p5, &p6);
|
||||||
if (ret != 6) {
|
if (ret != 6) {
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
@ -88,7 +84,7 @@ static ssize_t lbs_sleepparams_write(struct file *file,
|
|||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
|
|
||||||
out_unlock:
|
out_unlock:
|
||||||
free_page(addr);
|
kfree(buf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,18 +121,14 @@ static ssize_t lbs_host_sleep_write(struct file *file,
|
|||||||
loff_t *ppos)
|
loff_t *ppos)
|
||||||
{
|
{
|
||||||
struct lbs_private *priv = file->private_data;
|
struct lbs_private *priv = file->private_data;
|
||||||
ssize_t buf_size, ret;
|
ssize_t ret;
|
||||||
int host_sleep;
|
int host_sleep;
|
||||||
unsigned long addr = get_zeroed_page(GFP_KERNEL);
|
char *buf;
|
||||||
char *buf = (char *)addr;
|
|
||||||
if (!buf)
|
buf = memdup_user_nul(user_buf, min(count, len - 1));
|
||||||
return -ENOMEM;
|
if (IS_ERR(buf))
|
||||||
|
return PTR_ERR(buf);
|
||||||
|
|
||||||
buf_size = min(count, len - 1);
|
|
||||||
if (copy_from_user(buf, user_buf, buf_size)) {
|
|
||||||
ret = -EFAULT;
|
|
||||||
goto out_unlock;
|
|
||||||
}
|
|
||||||
ret = sscanf(buf, "%d", &host_sleep);
|
ret = sscanf(buf, "%d", &host_sleep);
|
||||||
if (ret != 1) {
|
if (ret != 1) {
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
@ -162,7 +154,7 @@ static ssize_t lbs_host_sleep_write(struct file *file,
|
|||||||
ret = count;
|
ret = count;
|
||||||
|
|
||||||
out_unlock:
|
out_unlock:
|
||||||
free_page(addr);
|
kfree(buf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,21 +273,15 @@ static ssize_t lbs_threshold_write(uint16_t tlv_type, uint16_t event_mask,
|
|||||||
struct cmd_ds_802_11_subscribe_event *events;
|
struct cmd_ds_802_11_subscribe_event *events;
|
||||||
struct mrvl_ie_thresholds *tlv;
|
struct mrvl_ie_thresholds *tlv;
|
||||||
struct lbs_private *priv = file->private_data;
|
struct lbs_private *priv = file->private_data;
|
||||||
ssize_t buf_size;
|
|
||||||
int value, freq, new_mask;
|
int value, freq, new_mask;
|
||||||
uint16_t curr_mask;
|
uint16_t curr_mask;
|
||||||
char *buf;
|
char *buf;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
buf = (char *)get_zeroed_page(GFP_KERNEL);
|
buf = memdup_user_nul(userbuf, min(count, len - 1));
|
||||||
if (!buf)
|
if (IS_ERR(buf))
|
||||||
return -ENOMEM;
|
return PTR_ERR(buf);
|
||||||
|
|
||||||
buf_size = min(count, len - 1);
|
|
||||||
if (copy_from_user(buf, userbuf, buf_size)) {
|
|
||||||
ret = -EFAULT;
|
|
||||||
goto out_page;
|
|
||||||
}
|
|
||||||
ret = sscanf(buf, "%d %d %d", &value, &freq, &new_mask);
|
ret = sscanf(buf, "%d %d %d", &value, &freq, &new_mask);
|
||||||
if (ret != 3) {
|
if (ret != 3) {
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
@ -343,7 +329,7 @@ static ssize_t lbs_threshold_write(uint16_t tlv_type, uint16_t event_mask,
|
|||||||
out_events:
|
out_events:
|
||||||
kfree(events);
|
kfree(events);
|
||||||
out_page:
|
out_page:
|
||||||
free_page((unsigned long)buf);
|
kfree(buf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -472,22 +458,15 @@ static ssize_t lbs_rdmac_write(struct file *file,
|
|||||||
size_t count, loff_t *ppos)
|
size_t count, loff_t *ppos)
|
||||||
{
|
{
|
||||||
struct lbs_private *priv = file->private_data;
|
struct lbs_private *priv = file->private_data;
|
||||||
ssize_t res, buf_size;
|
char *buf;
|
||||||
unsigned long addr = get_zeroed_page(GFP_KERNEL);
|
|
||||||
char *buf = (char *)addr;
|
buf = memdup_user_nul(userbuf, min(count, len - 1));
|
||||||
if (!buf)
|
if (IS_ERR(buf))
|
||||||
return -ENOMEM;
|
return PTR_ERR(buf);
|
||||||
|
|
||||||
buf_size = min(count, len - 1);
|
|
||||||
if (copy_from_user(buf, userbuf, buf_size)) {
|
|
||||||
res = -EFAULT;
|
|
||||||
goto out_unlock;
|
|
||||||
}
|
|
||||||
priv->mac_offset = simple_strtoul(buf, NULL, 16);
|
priv->mac_offset = simple_strtoul(buf, NULL, 16);
|
||||||
res = count;
|
kfree(buf);
|
||||||
out_unlock:
|
return count;
|
||||||
free_page(addr);
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t lbs_wrmac_write(struct file *file,
|
static ssize_t lbs_wrmac_write(struct file *file,
|
||||||
@ -496,18 +475,14 @@ static ssize_t lbs_wrmac_write(struct file *file,
|
|||||||
{
|
{
|
||||||
|
|
||||||
struct lbs_private *priv = file->private_data;
|
struct lbs_private *priv = file->private_data;
|
||||||
ssize_t res, buf_size;
|
ssize_t res;
|
||||||
u32 offset, value;
|
u32 offset, value;
|
||||||
unsigned long addr = get_zeroed_page(GFP_KERNEL);
|
char *buf;
|
||||||
char *buf = (char *)addr;
|
|
||||||
if (!buf)
|
buf = memdup_user_nul(userbuf, min(count, len - 1));
|
||||||
return -ENOMEM;
|
if (IS_ERR(buf))
|
||||||
|
return PTR_ERR(buf);
|
||||||
|
|
||||||
buf_size = min(count, len - 1);
|
|
||||||
if (copy_from_user(buf, userbuf, buf_size)) {
|
|
||||||
res = -EFAULT;
|
|
||||||
goto out_unlock;
|
|
||||||
}
|
|
||||||
res = sscanf(buf, "%x %x", &offset, &value);
|
res = sscanf(buf, "%x %x", &offset, &value);
|
||||||
if (res != 2) {
|
if (res != 2) {
|
||||||
res = -EFAULT;
|
res = -EFAULT;
|
||||||
@ -520,7 +495,7 @@ static ssize_t lbs_wrmac_write(struct file *file,
|
|||||||
if (!res)
|
if (!res)
|
||||||
res = count;
|
res = count;
|
||||||
out_unlock:
|
out_unlock:
|
||||||
free_page(addr);
|
kfree(buf);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -554,22 +529,16 @@ static ssize_t lbs_rdbbp_write(struct file *file,
|
|||||||
size_t count, loff_t *ppos)
|
size_t count, loff_t *ppos)
|
||||||
{
|
{
|
||||||
struct lbs_private *priv = file->private_data;
|
struct lbs_private *priv = file->private_data;
|
||||||
ssize_t res, buf_size;
|
char *buf;
|
||||||
unsigned long addr = get_zeroed_page(GFP_KERNEL);
|
|
||||||
char *buf = (char *)addr;
|
buf = memdup_user_nul(userbuf, min(count, len - 1));
|
||||||
if (!buf)
|
if (IS_ERR(buf))
|
||||||
return -ENOMEM;
|
return PTR_ERR(buf);
|
||||||
|
|
||||||
buf_size = min(count, len - 1);
|
|
||||||
if (copy_from_user(buf, userbuf, buf_size)) {
|
|
||||||
res = -EFAULT;
|
|
||||||
goto out_unlock;
|
|
||||||
}
|
|
||||||
priv->bbp_offset = simple_strtoul(buf, NULL, 16);
|
priv->bbp_offset = simple_strtoul(buf, NULL, 16);
|
||||||
res = count;
|
kfree(buf);
|
||||||
out_unlock:
|
|
||||||
free_page(addr);
|
return count;
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t lbs_wrbbp_write(struct file *file,
|
static ssize_t lbs_wrbbp_write(struct file *file,
|
||||||
@ -578,18 +547,14 @@ static ssize_t lbs_wrbbp_write(struct file *file,
|
|||||||
{
|
{
|
||||||
|
|
||||||
struct lbs_private *priv = file->private_data;
|
struct lbs_private *priv = file->private_data;
|
||||||
ssize_t res, buf_size;
|
ssize_t res;
|
||||||
u32 offset, value;
|
u32 offset, value;
|
||||||
unsigned long addr = get_zeroed_page(GFP_KERNEL);
|
char *buf;
|
||||||
char *buf = (char *)addr;
|
|
||||||
if (!buf)
|
buf = memdup_user_nul(userbuf, min(count, len - 1));
|
||||||
return -ENOMEM;
|
if (IS_ERR(buf))
|
||||||
|
return PTR_ERR(buf);
|
||||||
|
|
||||||
buf_size = min(count, len - 1);
|
|
||||||
if (copy_from_user(buf, userbuf, buf_size)) {
|
|
||||||
res = -EFAULT;
|
|
||||||
goto out_unlock;
|
|
||||||
}
|
|
||||||
res = sscanf(buf, "%x %x", &offset, &value);
|
res = sscanf(buf, "%x %x", &offset, &value);
|
||||||
if (res != 2) {
|
if (res != 2) {
|
||||||
res = -EFAULT;
|
res = -EFAULT;
|
||||||
@ -602,7 +567,7 @@ static ssize_t lbs_wrbbp_write(struct file *file,
|
|||||||
if (!res)
|
if (!res)
|
||||||
res = count;
|
res = count;
|
||||||
out_unlock:
|
out_unlock:
|
||||||
free_page(addr);
|
kfree(buf);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -636,22 +601,15 @@ static ssize_t lbs_rdrf_write(struct file *file,
|
|||||||
size_t count, loff_t *ppos)
|
size_t count, loff_t *ppos)
|
||||||
{
|
{
|
||||||
struct lbs_private *priv = file->private_data;
|
struct lbs_private *priv = file->private_data;
|
||||||
ssize_t res, buf_size;
|
char *buf;
|
||||||
unsigned long addr = get_zeroed_page(GFP_KERNEL);
|
|
||||||
char *buf = (char *)addr;
|
buf = memdup_user_nul(userbuf, min(count, len - 1));
|
||||||
if (!buf)
|
if (IS_ERR(buf))
|
||||||
return -ENOMEM;
|
return PTR_ERR(buf);
|
||||||
|
|
||||||
buf_size = min(count, len - 1);
|
|
||||||
if (copy_from_user(buf, userbuf, buf_size)) {
|
|
||||||
res = -EFAULT;
|
|
||||||
goto out_unlock;
|
|
||||||
}
|
|
||||||
priv->rf_offset = simple_strtoul(buf, NULL, 16);
|
priv->rf_offset = simple_strtoul(buf, NULL, 16);
|
||||||
res = count;
|
kfree(buf);
|
||||||
out_unlock:
|
return count;
|
||||||
free_page(addr);
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t lbs_wrrf_write(struct file *file,
|
static ssize_t lbs_wrrf_write(struct file *file,
|
||||||
@ -660,18 +618,14 @@ static ssize_t lbs_wrrf_write(struct file *file,
|
|||||||
{
|
{
|
||||||
|
|
||||||
struct lbs_private *priv = file->private_data;
|
struct lbs_private *priv = file->private_data;
|
||||||
ssize_t res, buf_size;
|
ssize_t res;
|
||||||
u32 offset, value;
|
u32 offset, value;
|
||||||
unsigned long addr = get_zeroed_page(GFP_KERNEL);
|
char *buf;
|
||||||
char *buf = (char *)addr;
|
|
||||||
if (!buf)
|
buf = memdup_user_nul(userbuf, min(count, len - 1));
|
||||||
return -ENOMEM;
|
if (IS_ERR(buf))
|
||||||
|
return PTR_ERR(buf);
|
||||||
|
|
||||||
buf_size = min(count, len - 1);
|
|
||||||
if (copy_from_user(buf, userbuf, buf_size)) {
|
|
||||||
res = -EFAULT;
|
|
||||||
goto out_unlock;
|
|
||||||
}
|
|
||||||
res = sscanf(buf, "%x %x", &offset, &value);
|
res = sscanf(buf, "%x %x", &offset, &value);
|
||||||
if (res != 2) {
|
if (res != 2) {
|
||||||
res = -EFAULT;
|
res = -EFAULT;
|
||||||
@ -684,7 +638,7 @@ static ssize_t lbs_wrrf_write(struct file *file,
|
|||||||
if (!res)
|
if (!res)
|
||||||
res = count;
|
res = count;
|
||||||
out_unlock:
|
out_unlock:
|
||||||
free_page(addr);
|
kfree(buf);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -915,16 +869,9 @@ static ssize_t lbs_debugfs_write(struct file *f, const char __user *buf,
|
|||||||
if (cnt == 0)
|
if (cnt == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
pdata = kmalloc(cnt + 1, GFP_KERNEL);
|
pdata = memdup_user_nul(buf, cnt);
|
||||||
if (pdata == NULL)
|
if (IS_ERR(pdata))
|
||||||
return 0;
|
return PTR_ERR(pdata);
|
||||||
|
|
||||||
if (copy_from_user(pdata, buf, cnt)) {
|
|
||||||
lbs_deb_debugfs("Copy from user failed\n");
|
|
||||||
kfree(pdata);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
pdata[cnt] = '\0';
|
|
||||||
|
|
||||||
p0 = pdata;
|
p0 = pdata;
|
||||||
for (i = 0; i < num_of_items; i++) {
|
for (i = 0; i < num_of_items; i++) {
|
||||||
|
@ -447,20 +447,13 @@ static ssize_t
|
|||||||
mwifiex_regrdwr_write(struct file *file,
|
mwifiex_regrdwr_write(struct file *file,
|
||||||
const char __user *ubuf, size_t count, loff_t *ppos)
|
const char __user *ubuf, size_t count, loff_t *ppos)
|
||||||
{
|
{
|
||||||
unsigned long addr = get_zeroed_page(GFP_KERNEL);
|
char *buf;
|
||||||
char *buf = (char *) addr;
|
|
||||||
size_t buf_size = min_t(size_t, count, PAGE_SIZE - 1);
|
|
||||||
int ret;
|
int ret;
|
||||||
u32 reg_type = 0, reg_offset = 0, reg_value = UINT_MAX;
|
u32 reg_type = 0, reg_offset = 0, reg_value = UINT_MAX;
|
||||||
|
|
||||||
if (!buf)
|
buf = memdup_user_nul(ubuf, min(count, (size_t)(PAGE_SIZE - 1)));
|
||||||
return -ENOMEM;
|
if (IS_ERR(buf))
|
||||||
|
return PTR_ERR(buf);
|
||||||
|
|
||||||
if (copy_from_user(buf, ubuf, buf_size)) {
|
|
||||||
ret = -EFAULT;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
sscanf(buf, "%u %x %x", ®_type, ®_offset, ®_value);
|
sscanf(buf, "%u %x %x", ®_type, ®_offset, ®_value);
|
||||||
|
|
||||||
@ -474,7 +467,7 @@ mwifiex_regrdwr_write(struct file *file,
|
|||||||
ret = count;
|
ret = count;
|
||||||
}
|
}
|
||||||
done:
|
done:
|
||||||
free_page(addr);
|
kfree(buf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -572,17 +565,11 @@ mwifiex_debug_mask_write(struct file *file, const char __user *ubuf,
|
|||||||
int ret;
|
int ret;
|
||||||
unsigned long debug_mask;
|
unsigned long debug_mask;
|
||||||
struct mwifiex_private *priv = (void *)file->private_data;
|
struct mwifiex_private *priv = (void *)file->private_data;
|
||||||
unsigned long addr = get_zeroed_page(GFP_KERNEL);
|
char *buf;
|
||||||
char *buf = (void *)addr;
|
|
||||||
size_t buf_size = min(count, (size_t)(PAGE_SIZE - 1));
|
|
||||||
|
|
||||||
if (!buf)
|
buf = memdup_user_nul(ubuf, min(count, (size_t)(PAGE_SIZE - 1)));
|
||||||
return -ENOMEM;
|
if (IS_ERR(buf))
|
||||||
|
return PTR_ERR(buf);
|
||||||
if (copy_from_user(buf, ubuf, buf_size)) {
|
|
||||||
ret = -EFAULT;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (kstrtoul(buf, 0, &debug_mask)) {
|
if (kstrtoul(buf, 0, &debug_mask)) {
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
@ -592,7 +579,7 @@ mwifiex_debug_mask_write(struct file *file, const char __user *ubuf,
|
|||||||
priv->adapter->debug_mask = debug_mask;
|
priv->adapter->debug_mask = debug_mask;
|
||||||
ret = count;
|
ret = count;
|
||||||
done:
|
done:
|
||||||
free_page(addr);
|
kfree(buf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -609,17 +596,11 @@ mwifiex_memrw_write(struct file *file, const char __user *ubuf, size_t count,
|
|||||||
struct mwifiex_ds_mem_rw mem_rw;
|
struct mwifiex_ds_mem_rw mem_rw;
|
||||||
u16 cmd_action;
|
u16 cmd_action;
|
||||||
struct mwifiex_private *priv = (void *)file->private_data;
|
struct mwifiex_private *priv = (void *)file->private_data;
|
||||||
unsigned long addr = get_zeroed_page(GFP_KERNEL);
|
char *buf;
|
||||||
char *buf = (void *)addr;
|
|
||||||
size_t buf_size = min(count, (size_t)(PAGE_SIZE - 1));
|
|
||||||
|
|
||||||
if (!buf)
|
buf = memdup_user_nul(ubuf, min(count, (size_t)(PAGE_SIZE - 1)));
|
||||||
return -ENOMEM;
|
if (IS_ERR(buf))
|
||||||
|
return PTR_ERR(buf);
|
||||||
if (copy_from_user(buf, ubuf, buf_size)) {
|
|
||||||
ret = -EFAULT;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = sscanf(buf, "%c %x %x", &cmd, &mem_rw.addr, &mem_rw.value);
|
ret = sscanf(buf, "%c %x %x", &cmd, &mem_rw.addr, &mem_rw.value);
|
||||||
if (ret != 3) {
|
if (ret != 3) {
|
||||||
@ -645,7 +626,7 @@ mwifiex_memrw_write(struct file *file, const char __user *ubuf, size_t count,
|
|||||||
ret = count;
|
ret = count;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
free_page(addr);
|
kfree(buf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -686,20 +667,13 @@ static ssize_t
|
|||||||
mwifiex_rdeeprom_write(struct file *file,
|
mwifiex_rdeeprom_write(struct file *file,
|
||||||
const char __user *ubuf, size_t count, loff_t *ppos)
|
const char __user *ubuf, size_t count, loff_t *ppos)
|
||||||
{
|
{
|
||||||
unsigned long addr = get_zeroed_page(GFP_KERNEL);
|
char *buf;
|
||||||
char *buf = (char *) addr;
|
|
||||||
size_t buf_size = min_t(size_t, count, PAGE_SIZE - 1);
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int offset = -1, bytes = -1;
|
int offset = -1, bytes = -1;
|
||||||
|
|
||||||
if (!buf)
|
buf = memdup_user_nul(ubuf, min(count, (size_t)(PAGE_SIZE - 1)));
|
||||||
return -ENOMEM;
|
if (IS_ERR(buf))
|
||||||
|
return PTR_ERR(buf);
|
||||||
|
|
||||||
if (copy_from_user(buf, ubuf, buf_size)) {
|
|
||||||
ret = -EFAULT;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
sscanf(buf, "%d %d", &offset, &bytes);
|
sscanf(buf, "%d %d", &offset, &bytes);
|
||||||
|
|
||||||
@ -712,7 +686,7 @@ mwifiex_rdeeprom_write(struct file *file,
|
|||||||
ret = count;
|
ret = count;
|
||||||
}
|
}
|
||||||
done:
|
done:
|
||||||
free_page(addr);
|
kfree(buf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -771,21 +745,15 @@ mwifiex_hscfg_write(struct file *file, const char __user *ubuf,
|
|||||||
size_t count, loff_t *ppos)
|
size_t count, loff_t *ppos)
|
||||||
{
|
{
|
||||||
struct mwifiex_private *priv = (void *)file->private_data;
|
struct mwifiex_private *priv = (void *)file->private_data;
|
||||||
unsigned long addr = get_zeroed_page(GFP_KERNEL);
|
char *buf;
|
||||||
char *buf = (char *)addr;
|
|
||||||
size_t buf_size = min_t(size_t, count, PAGE_SIZE - 1);
|
|
||||||
int ret, arg_num;
|
int ret, arg_num;
|
||||||
struct mwifiex_ds_hs_cfg hscfg;
|
struct mwifiex_ds_hs_cfg hscfg;
|
||||||
int conditions = HS_CFG_COND_DEF;
|
int conditions = HS_CFG_COND_DEF;
|
||||||
u32 gpio = HS_CFG_GPIO_DEF, gap = HS_CFG_GAP_DEF;
|
u32 gpio = HS_CFG_GPIO_DEF, gap = HS_CFG_GAP_DEF;
|
||||||
|
|
||||||
if (!buf)
|
buf = memdup_user_nul(ubuf, min(count, (size_t)(PAGE_SIZE - 1)));
|
||||||
return -ENOMEM;
|
if (IS_ERR(buf))
|
||||||
|
return PTR_ERR(buf);
|
||||||
if (copy_from_user(buf, ubuf, buf_size)) {
|
|
||||||
ret = -EFAULT;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
arg_num = sscanf(buf, "%d %x %x", &conditions, &gpio, &gap);
|
arg_num = sscanf(buf, "%d %x %x", &conditions, &gpio, &gap);
|
||||||
|
|
||||||
@ -823,7 +791,7 @@ mwifiex_hscfg_write(struct file *file, const char __user *ubuf,
|
|||||||
priv->adapter->hs_enabling = false;
|
priv->adapter->hs_enabling = false;
|
||||||
ret = count;
|
ret = count;
|
||||||
done:
|
done:
|
||||||
free_page(addr);
|
kfree(buf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1205,26 +1205,11 @@ static ssize_t dev_mem_write(struct file *file, const char __user *user_buf,
|
|||||||
|
|
||||||
static loff_t dev_mem_seek(struct file *file, loff_t offset, int orig)
|
static loff_t dev_mem_seek(struct file *file, loff_t offset, int orig)
|
||||||
{
|
{
|
||||||
loff_t ret;
|
|
||||||
|
|
||||||
/* only requests of dword-aligned size and offset are supported */
|
/* only requests of dword-aligned size and offset are supported */
|
||||||
if (offset % 4)
|
if (offset % 4)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
switch (orig) {
|
return no_seek_end_llseek(file, offset, orig);
|
||||||
case SEEK_SET:
|
|
||||||
file->f_pos = offset;
|
|
||||||
ret = file->f_pos;
|
|
||||||
break;
|
|
||||||
case SEEK_CUR:
|
|
||||||
file->f_pos += offset;
|
|
||||||
ret = file->f_pos;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
ret = -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations dev_mem_ops = {
|
static const struct file_operations dev_mem_ops = {
|
||||||
|
@ -88,14 +88,9 @@ vmcp_write(struct file *file, const char __user *buff, size_t count,
|
|||||||
|
|
||||||
if (count > 240)
|
if (count > 240)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
cmd = kmalloc(count + 1, GFP_KERNEL);
|
cmd = memdup_user_nul(buff, count);
|
||||||
if (!cmd)
|
if (IS_ERR(cmd))
|
||||||
return -ENOMEM;
|
return PTR_ERR(cmd);
|
||||||
if (copy_from_user(cmd, buff, count)) {
|
|
||||||
kfree(cmd);
|
|
||||||
return -EFAULT;
|
|
||||||
}
|
|
||||||
cmd[count] = '\0';
|
|
||||||
session = file->private_data;
|
session = file->private_data;
|
||||||
if (mutex_lock_interruptible(&session->mutex)) {
|
if (mutex_lock_interruptible(&session->mutex)) {
|
||||||
kfree(cmd);
|
kfree(cmd);
|
||||||
|
@ -782,24 +782,11 @@ static int ur_release(struct inode *inode, struct file *file)
|
|||||||
|
|
||||||
static loff_t ur_llseek(struct file *file, loff_t offset, int whence)
|
static loff_t ur_llseek(struct file *file, loff_t offset, int whence)
|
||||||
{
|
{
|
||||||
loff_t newpos;
|
|
||||||
|
|
||||||
if ((file->f_flags & O_ACCMODE) != O_RDONLY)
|
if ((file->f_flags & O_ACCMODE) != O_RDONLY)
|
||||||
return -ESPIPE; /* seek allowed only for reader */
|
return -ESPIPE; /* seek allowed only for reader */
|
||||||
if (offset % PAGE_SIZE)
|
if (offset % PAGE_SIZE)
|
||||||
return -ESPIPE; /* only multiples of 4K allowed */
|
return -ESPIPE; /* only multiples of 4K allowed */
|
||||||
switch (whence) {
|
return no_seek_end_llseek(file, offset, whence);
|
||||||
case 0: /* SEEK_SET */
|
|
||||||
newpos = offset;
|
|
||||||
break;
|
|
||||||
case 1: /* SEEK_CUR */
|
|
||||||
newpos = file->f_pos + offset;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
file->f_pos = newpos;
|
|
||||||
return newpos;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations ur_fops = {
|
static const struct file_operations ur_fops = {
|
||||||
|
@ -385,18 +385,7 @@ static loff_t zcore_lseek(struct file *file, loff_t offset, int orig)
|
|||||||
loff_t rc;
|
loff_t rc;
|
||||||
|
|
||||||
mutex_lock(&zcore_mutex);
|
mutex_lock(&zcore_mutex);
|
||||||
switch (orig) {
|
rc = no_seek_end_llseek(file, offset, orig);
|
||||||
case 0:
|
|
||||||
file->f_pos = offset;
|
|
||||||
rc = file->f_pos;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
file->f_pos += offset;
|
|
||||||
rc = file->f_pos;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
rc = -EINVAL;
|
|
||||||
}
|
|
||||||
mutex_unlock(&zcore_mutex);
|
mutex_unlock(&zcore_mutex);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -390,16 +390,9 @@ static int copyin_string(char __user *user, size_t len, char **ptr)
|
|||||||
if ((ssize_t)len < 0 || (ssize_t)(len + 1) < 0)
|
if ((ssize_t)len < 0 || (ssize_t)(len + 1) < 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
tmp = kmalloc(len + 1, GFP_KERNEL);
|
tmp = memdup_user_nul(user, len);
|
||||||
if (!tmp)
|
if (IS_ERR(tmp))
|
||||||
return -ENOMEM;
|
return PTR_ERR(tmp);
|
||||||
|
|
||||||
if (copy_from_user(tmp, user, len)) {
|
|
||||||
kfree(tmp);
|
|
||||||
return -EFAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
tmp[len] = '\0';
|
|
||||||
|
|
||||||
*ptr = tmp;
|
*ptr = tmp;
|
||||||
|
|
||||||
|
@ -3139,7 +3139,7 @@ struct file_operations ll_file_operations_noflock = {
|
|||||||
.lock = ll_file_noflock
|
.lock = ll_file_noflock
|
||||||
};
|
};
|
||||||
|
|
||||||
struct inode_operations ll_file_inode_operations = {
|
const struct inode_operations ll_file_inode_operations = {
|
||||||
.setattr = ll_setattr,
|
.setattr = ll_setattr,
|
||||||
.getattr = ll_getattr,
|
.getattr = ll_getattr,
|
||||||
.permission = ll_inode_permission,
|
.permission = ll_inode_permission,
|
||||||
|
@ -705,7 +705,7 @@ extern const struct address_space_operations ll_aops;
|
|||||||
extern struct file_operations ll_file_operations;
|
extern struct file_operations ll_file_operations;
|
||||||
extern struct file_operations ll_file_operations_flock;
|
extern struct file_operations ll_file_operations_flock;
|
||||||
extern struct file_operations ll_file_operations_noflock;
|
extern struct file_operations ll_file_operations_noflock;
|
||||||
extern struct inode_operations ll_file_inode_operations;
|
extern const struct inode_operations ll_file_inode_operations;
|
||||||
int ll_have_md_lock(struct inode *inode, __u64 *bits,
|
int ll_have_md_lock(struct inode *inode, __u64 *bits,
|
||||||
ldlm_mode_t l_req_mode);
|
ldlm_mode_t l_req_mode);
|
||||||
ldlm_mode_t ll_take_md_lock(struct inode *inode, __u64 bits,
|
ldlm_mode_t ll_take_md_lock(struct inode *inode, __u64 bits,
|
||||||
@ -805,7 +805,7 @@ struct inode *search_inode_for_lustre(struct super_block *sb,
|
|||||||
const struct lu_fid *fid);
|
const struct lu_fid *fid);
|
||||||
|
|
||||||
/* llite/symlink.c */
|
/* llite/symlink.c */
|
||||||
extern struct inode_operations ll_fast_symlink_inode_operations;
|
extern const struct inode_operations ll_fast_symlink_inode_operations;
|
||||||
|
|
||||||
/* llite/llite_close.c */
|
/* llite/llite_close.c */
|
||||||
struct ll_close_queue {
|
struct ll_close_queue {
|
||||||
|
@ -126,9 +126,7 @@ struct inode *ll_iget(struct super_block *sb, ino_t hash,
|
|||||||
rc = cl_file_inode_init(inode, md);
|
rc = cl_file_inode_init(inode, md);
|
||||||
}
|
}
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
make_bad_inode(inode);
|
iget_failed(inode);
|
||||||
unlock_new_inode(inode);
|
|
||||||
iput(inode);
|
|
||||||
inode = ERR_PTR(rc);
|
inode = ERR_PTR(rc);
|
||||||
} else
|
} else
|
||||||
unlock_new_inode(inode);
|
unlock_new_inode(inode);
|
||||||
|
@ -149,7 +149,7 @@ static const char *ll_get_link(struct dentry *dentry,
|
|||||||
return symname;
|
return symname;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct inode_operations ll_fast_symlink_inode_operations = {
|
const struct inode_operations ll_fast_symlink_inode_operations = {
|
||||||
.readlink = generic_readlink,
|
.readlink = generic_readlink,
|
||||||
.setattr = ll_setattr,
|
.setattr = ll_setattr,
|
||||||
.get_link = ll_get_link,
|
.get_link = ll_get_link,
|
||||||
|
@ -661,32 +661,8 @@ static unsigned int usb_device_poll(struct file *file,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static loff_t usb_device_lseek(struct file *file, loff_t offset, int orig)
|
|
||||||
{
|
|
||||||
loff_t ret;
|
|
||||||
|
|
||||||
mutex_lock(&file_inode(file)->i_mutex);
|
|
||||||
|
|
||||||
switch (orig) {
|
|
||||||
case 0:
|
|
||||||
file->f_pos = offset;
|
|
||||||
ret = file->f_pos;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
file->f_pos += offset;
|
|
||||||
ret = file->f_pos;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
default:
|
|
||||||
ret = -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
mutex_unlock(&file_inode(file)->i_mutex);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
const struct file_operations usbfs_devices_fops = {
|
const struct file_operations usbfs_devices_fops = {
|
||||||
.llseek = usb_device_lseek,
|
.llseek = no_seek_end_llseek,
|
||||||
.read = usb_device_read,
|
.read = usb_device_read,
|
||||||
.poll = usb_device_poll,
|
.poll = usb_device_poll,
|
||||||
};
|
};
|
||||||
|
@ -157,30 +157,6 @@ static int connected(struct usb_dev_state *ps)
|
|||||||
ps->dev->state != USB_STATE_NOTATTACHED);
|
ps->dev->state != USB_STATE_NOTATTACHED);
|
||||||
}
|
}
|
||||||
|
|
||||||
static loff_t usbdev_lseek(struct file *file, loff_t offset, int orig)
|
|
||||||
{
|
|
||||||
loff_t ret;
|
|
||||||
|
|
||||||
mutex_lock(&file_inode(file)->i_mutex);
|
|
||||||
|
|
||||||
switch (orig) {
|
|
||||||
case 0:
|
|
||||||
file->f_pos = offset;
|
|
||||||
ret = file->f_pos;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
file->f_pos += offset;
|
|
||||||
ret = file->f_pos;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
default:
|
|
||||||
ret = -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
mutex_unlock(&file_inode(file)->i_mutex);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ssize_t usbdev_read(struct file *file, char __user *buf, size_t nbytes,
|
static ssize_t usbdev_read(struct file *file, char __user *buf, size_t nbytes,
|
||||||
loff_t *ppos)
|
loff_t *ppos)
|
||||||
{
|
{
|
||||||
@ -2366,7 +2342,7 @@ static unsigned int usbdev_poll(struct file *file,
|
|||||||
|
|
||||||
const struct file_operations usbdev_file_operations = {
|
const struct file_operations usbdev_file_operations = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.llseek = usbdev_lseek,
|
.llseek = no_seek_end_llseek,
|
||||||
.read = usbdev_read,
|
.read = usbdev_read,
|
||||||
.poll = usbdev_poll,
|
.poll = usbdev_poll,
|
||||||
.unlocked_ioctl = usbdev_ioctl,
|
.unlocked_ioctl = usbdev_ioctl,
|
||||||
|
@ -584,27 +584,8 @@ static int uhci_debug_open(struct inode *inode, struct file *file)
|
|||||||
|
|
||||||
static loff_t uhci_debug_lseek(struct file *file, loff_t off, int whence)
|
static loff_t uhci_debug_lseek(struct file *file, loff_t off, int whence)
|
||||||
{
|
{
|
||||||
struct uhci_debug *up;
|
struct uhci_debug *up = file->private_data;
|
||||||
loff_t new = -1;
|
return no_seek_end_llseek_size(file, off, whence, up->size);
|
||||||
|
|
||||||
up = file->private_data;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* XXX: atomic 64bit seek access, but that needs to be fixed in the VFS
|
|
||||||
*/
|
|
||||||
switch (whence) {
|
|
||||||
case 0:
|
|
||||||
new = off;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
new = file->f_pos + off;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (new < 0 || new > up->size)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
return (file->f_pos = new);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t uhci_debug_read(struct file *file, char __user *buf,
|
static ssize_t uhci_debug_read(struct file *file, char __user *buf,
|
||||||
|
@ -2825,21 +2825,7 @@ sisusb_lseek(struct file *file, loff_t offset, int orig)
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (orig) {
|
ret = no_seek_end_llseek(file, offset, orig);
|
||||||
case 0:
|
|
||||||
file->f_pos = offset;
|
|
||||||
ret = file->f_pos;
|
|
||||||
/* never negative, no force_successful_syscall needed */
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
file->f_pos += offset;
|
|
||||||
ret = file->f_pos;
|
|
||||||
/* never negative, no force_successful_syscall needed */
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
/* seeking relative to "end of file" is not supported */
|
|
||||||
ret = -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
mutex_unlock(&sisusb->lock);
|
mutex_unlock(&sisusb->lock);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -243,14 +243,14 @@ void v9fs_cache_inode_set_cookie(struct inode *inode, struct file *filp)
|
|||||||
if (!v9inode->fscache)
|
if (!v9inode->fscache)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
spin_lock(&v9inode->fscache_lock);
|
mutex_lock(&v9inode->fscache_lock);
|
||||||
|
|
||||||
if ((filp->f_flags & O_ACCMODE) != O_RDONLY)
|
if ((filp->f_flags & O_ACCMODE) != O_RDONLY)
|
||||||
v9fs_cache_inode_flush_cookie(inode);
|
v9fs_cache_inode_flush_cookie(inode);
|
||||||
else
|
else
|
||||||
v9fs_cache_inode_get_cookie(inode);
|
v9fs_cache_inode_get_cookie(inode);
|
||||||
|
|
||||||
spin_unlock(&v9inode->fscache_lock);
|
mutex_unlock(&v9inode->fscache_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void v9fs_cache_inode_reset_cookie(struct inode *inode)
|
void v9fs_cache_inode_reset_cookie(struct inode *inode)
|
||||||
@ -264,7 +264,7 @@ void v9fs_cache_inode_reset_cookie(struct inode *inode)
|
|||||||
|
|
||||||
old = v9inode->fscache;
|
old = v9inode->fscache;
|
||||||
|
|
||||||
spin_lock(&v9inode->fscache_lock);
|
mutex_lock(&v9inode->fscache_lock);
|
||||||
fscache_relinquish_cookie(v9inode->fscache, 1);
|
fscache_relinquish_cookie(v9inode->fscache, 1);
|
||||||
|
|
||||||
v9ses = v9fs_inode2v9ses(inode);
|
v9ses = v9fs_inode2v9ses(inode);
|
||||||
@ -274,7 +274,7 @@ void v9fs_cache_inode_reset_cookie(struct inode *inode)
|
|||||||
p9_debug(P9_DEBUG_FSC, "inode %p revalidating cookie old %p new %p\n",
|
p9_debug(P9_DEBUG_FSC, "inode %p revalidating cookie old %p new %p\n",
|
||||||
inode, old, v9inode->fscache);
|
inode, old, v9inode->fscache);
|
||||||
|
|
||||||
spin_unlock(&v9inode->fscache_lock);
|
mutex_unlock(&v9inode->fscache_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
int __v9fs_fscache_release_page(struct page *page, gfp_t gfp)
|
int __v9fs_fscache_release_page(struct page *page, gfp_t gfp)
|
||||||
|
@ -123,7 +123,7 @@ struct v9fs_session_info {
|
|||||||
|
|
||||||
struct v9fs_inode {
|
struct v9fs_inode {
|
||||||
#ifdef CONFIG_9P_FSCACHE
|
#ifdef CONFIG_9P_FSCACHE
|
||||||
spinlock_t fscache_lock;
|
struct mutex fscache_lock;
|
||||||
struct fscache_cookie *fscache;
|
struct fscache_cookie *fscache;
|
||||||
#endif
|
#endif
|
||||||
struct p9_qid qid;
|
struct p9_qid qid;
|
||||||
|
@ -244,7 +244,7 @@ struct inode *v9fs_alloc_inode(struct super_block *sb)
|
|||||||
return NULL;
|
return NULL;
|
||||||
#ifdef CONFIG_9P_FSCACHE
|
#ifdef CONFIG_9P_FSCACHE
|
||||||
v9inode->fscache = NULL;
|
v9inode->fscache = NULL;
|
||||||
spin_lock_init(&v9inode->fscache_lock);
|
mutex_init(&v9inode->fscache_lock);
|
||||||
#endif
|
#endif
|
||||||
v9inode->writeback_fid = NULL;
|
v9inode->writeback_fid = NULL;
|
||||||
v9inode->cache_validity = 0;
|
v9inode->cache_validity = 0;
|
||||||
|
@ -45,7 +45,7 @@ struct adfs_dir_ops;
|
|||||||
struct adfs_sb_info {
|
struct adfs_sb_info {
|
||||||
union { struct {
|
union { struct {
|
||||||
struct adfs_discmap *s_map; /* bh list containing map */
|
struct adfs_discmap *s_map; /* bh list containing map */
|
||||||
struct adfs_dir_ops *s_dir; /* directory operations */
|
const struct adfs_dir_ops *s_dir; /* directory operations */
|
||||||
};
|
};
|
||||||
struct rcu_head rcu; /* used only at shutdown time */
|
struct rcu_head rcu; /* used only at shutdown time */
|
||||||
};
|
};
|
||||||
@ -168,8 +168,8 @@ void __adfs_error(struct super_block *sb, const char *function,
|
|||||||
extern const struct inode_operations adfs_dir_inode_operations;
|
extern const struct inode_operations adfs_dir_inode_operations;
|
||||||
extern const struct file_operations adfs_dir_operations;
|
extern const struct file_operations adfs_dir_operations;
|
||||||
extern const struct dentry_operations adfs_dentry_operations;
|
extern const struct dentry_operations adfs_dentry_operations;
|
||||||
extern struct adfs_dir_ops adfs_f_dir_ops;
|
extern const struct adfs_dir_ops adfs_f_dir_ops;
|
||||||
extern struct adfs_dir_ops adfs_fplus_dir_ops;
|
extern const struct adfs_dir_ops adfs_fplus_dir_ops;
|
||||||
|
|
||||||
extern int adfs_dir_update(struct super_block *sb, struct object_info *obj,
|
extern int adfs_dir_update(struct super_block *sb, struct object_info *obj,
|
||||||
int wait);
|
int wait);
|
||||||
|
@ -21,7 +21,7 @@ adfs_readdir(struct file *file, struct dir_context *ctx)
|
|||||||
{
|
{
|
||||||
struct inode *inode = file_inode(file);
|
struct inode *inode = file_inode(file);
|
||||||
struct super_block *sb = inode->i_sb;
|
struct super_block *sb = inode->i_sb;
|
||||||
struct adfs_dir_ops *ops = ADFS_SB(sb)->s_dir;
|
const struct adfs_dir_ops *ops = ADFS_SB(sb)->s_dir;
|
||||||
struct object_info obj;
|
struct object_info obj;
|
||||||
struct adfs_dir dir;
|
struct adfs_dir dir;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@ -69,7 +69,7 @@ adfs_dir_update(struct super_block *sb, struct object_info *obj, int wait)
|
|||||||
{
|
{
|
||||||
int ret = -EINVAL;
|
int ret = -EINVAL;
|
||||||
#ifdef CONFIG_ADFS_FS_RW
|
#ifdef CONFIG_ADFS_FS_RW
|
||||||
struct adfs_dir_ops *ops = ADFS_SB(sb)->s_dir;
|
const struct adfs_dir_ops *ops = ADFS_SB(sb)->s_dir;
|
||||||
struct adfs_dir dir;
|
struct adfs_dir dir;
|
||||||
|
|
||||||
printk(KERN_INFO "adfs_dir_update: object %06X in dir %06X\n",
|
printk(KERN_INFO "adfs_dir_update: object %06X in dir %06X\n",
|
||||||
@ -129,7 +129,7 @@ static int
|
|||||||
adfs_dir_lookup_byname(struct inode *inode, struct qstr *name, struct object_info *obj)
|
adfs_dir_lookup_byname(struct inode *inode, struct qstr *name, struct object_info *obj)
|
||||||
{
|
{
|
||||||
struct super_block *sb = inode->i_sb;
|
struct super_block *sb = inode->i_sb;
|
||||||
struct adfs_dir_ops *ops = ADFS_SB(sb)->s_dir;
|
const struct adfs_dir_ops *ops = ADFS_SB(sb)->s_dir;
|
||||||
struct adfs_dir dir;
|
struct adfs_dir dir;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -476,7 +476,7 @@ adfs_f_free(struct adfs_dir *dir)
|
|||||||
dir->sb = NULL;
|
dir->sb = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct adfs_dir_ops adfs_f_dir_ops = {
|
const struct adfs_dir_ops adfs_f_dir_ops = {
|
||||||
.read = adfs_f_read,
|
.read = adfs_f_read,
|
||||||
.setpos = adfs_f_setpos,
|
.setpos = adfs_f_setpos,
|
||||||
.getnext = adfs_f_getnext,
|
.getnext = adfs_f_getnext,
|
||||||
|
@ -256,7 +256,7 @@ adfs_fplus_free(struct adfs_dir *dir)
|
|||||||
dir->sb = NULL;
|
dir->sb = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct adfs_dir_ops adfs_fplus_dir_ops = {
|
const struct adfs_dir_ops adfs_fplus_dir_ops = {
|
||||||
.read = adfs_fplus_read,
|
.read = adfs_fplus_read,
|
||||||
.setpos = adfs_fplus_setpos,
|
.setpos = adfs_fplus_setpos,
|
||||||
.getnext = adfs_fplus_getnext,
|
.getnext = adfs_fplus_getnext,
|
||||||
|
@ -138,7 +138,7 @@ extern int affs_remove_hash(struct inode *dir, struct buffer_head *rem_bh);
|
|||||||
extern int affs_remove_header(struct dentry *dentry);
|
extern int affs_remove_header(struct dentry *dentry);
|
||||||
extern u32 affs_checksum_block(struct super_block *sb, struct buffer_head *bh);
|
extern u32 affs_checksum_block(struct super_block *sb, struct buffer_head *bh);
|
||||||
extern void affs_fix_checksum(struct super_block *sb, struct buffer_head *bh);
|
extern void affs_fix_checksum(struct super_block *sb, struct buffer_head *bh);
|
||||||
extern void secs_to_datestamp(time_t secs, struct affs_date *ds);
|
extern void secs_to_datestamp(time64_t secs, struct affs_date *ds);
|
||||||
extern umode_t prot_to_mode(u32 prot);
|
extern umode_t prot_to_mode(u32 prot);
|
||||||
extern void mode_to_prot(struct inode *inode);
|
extern void mode_to_prot(struct inode *inode);
|
||||||
__printf(3, 4)
|
__printf(3, 4)
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
* Please send bug reports to: hjw@zvw.de
|
* Please send bug reports to: hjw@zvw.de
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <linux/math64.h>
|
||||||
#include "affs.h"
|
#include "affs.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -366,22 +367,22 @@ affs_fix_checksum(struct super_block *sb, struct buffer_head *bh)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
secs_to_datestamp(time_t secs, struct affs_date *ds)
|
secs_to_datestamp(time64_t secs, struct affs_date *ds)
|
||||||
{
|
{
|
||||||
u32 days;
|
u32 days;
|
||||||
u32 minute;
|
u32 minute;
|
||||||
|
s32 rem;
|
||||||
|
|
||||||
secs -= sys_tz.tz_minuteswest * 60 + ((8 * 365 + 2) * 24 * 60 * 60);
|
secs -= sys_tz.tz_minuteswest * 60 + ((8 * 365 + 2) * 24 * 60 * 60);
|
||||||
if (secs < 0)
|
if (secs < 0)
|
||||||
secs = 0;
|
secs = 0;
|
||||||
days = secs / 86400;
|
days = div_s64_rem(secs, 86400, &rem);
|
||||||
secs -= days * 86400;
|
minute = rem / 60;
|
||||||
minute = secs / 60;
|
rem -= minute * 60;
|
||||||
secs -= minute * 60;
|
|
||||||
|
|
||||||
ds->days = cpu_to_be32(days);
|
ds->days = cpu_to_be32(days);
|
||||||
ds->mins = cpu_to_be32(minute);
|
ds->mins = cpu_to_be32(minute);
|
||||||
ds->ticks = cpu_to_be32(secs * 50);
|
ds->ticks = cpu_to_be32(rem * 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
umode_t
|
umode_t
|
||||||
|
@ -32,7 +32,7 @@ affs_commit_super(struct super_block *sb, int wait)
|
|||||||
struct affs_root_tail *tail = AFFS_ROOT_TAIL(sb, bh);
|
struct affs_root_tail *tail = AFFS_ROOT_TAIL(sb, bh);
|
||||||
|
|
||||||
lock_buffer(bh);
|
lock_buffer(bh);
|
||||||
secs_to_datestamp(get_seconds(), &tail->disk_change);
|
secs_to_datestamp(ktime_get_real_seconds(), &tail->disk_change);
|
||||||
affs_fix_checksum(sb, bh);
|
affs_fix_checksum(sb, bh);
|
||||||
unlock_buffer(bh);
|
unlock_buffer(bh);
|
||||||
|
|
||||||
|
@ -230,14 +230,9 @@ static ssize_t afs_proc_cells_write(struct file *file, const char __user *buf,
|
|||||||
if (size <= 1 || size >= PAGE_SIZE)
|
if (size <= 1 || size >= PAGE_SIZE)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
kbuf = kmalloc(size + 1, GFP_KERNEL);
|
kbuf = memdup_user_nul(buf, size);
|
||||||
if (!kbuf)
|
if (IS_ERR(kbuf))
|
||||||
return -ENOMEM;
|
return PTR_ERR(kbuf);
|
||||||
|
|
||||||
ret = -EFAULT;
|
|
||||||
if (copy_from_user(kbuf, buf, size) != 0)
|
|
||||||
goto done;
|
|
||||||
kbuf[size] = 0;
|
|
||||||
|
|
||||||
/* trim to first NL */
|
/* trim to first NL */
|
||||||
name = memchr(kbuf, '\n', size);
|
name = memchr(kbuf, '\n', size);
|
||||||
@ -315,15 +310,9 @@ static ssize_t afs_proc_rootcell_write(struct file *file,
|
|||||||
if (size <= 1 || size >= PAGE_SIZE)
|
if (size <= 1 || size >= PAGE_SIZE)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
ret = -ENOMEM;
|
kbuf = memdup_user_nul(buf, size);
|
||||||
kbuf = kmalloc(size + 1, GFP_KERNEL);
|
if (IS_ERR(kbuf))
|
||||||
if (!kbuf)
|
return PTR_ERR(kbuf);
|
||||||
goto nomem;
|
|
||||||
|
|
||||||
ret = -EFAULT;
|
|
||||||
if (copy_from_user(kbuf, buf, size) != 0)
|
|
||||||
goto infault;
|
|
||||||
kbuf[size] = 0;
|
|
||||||
|
|
||||||
/* trim to first NL */
|
/* trim to first NL */
|
||||||
s = memchr(kbuf, '\n', size);
|
s = memchr(kbuf, '\n', size);
|
||||||
@ -337,9 +326,7 @@ static ssize_t afs_proc_rootcell_write(struct file *file,
|
|||||||
if (ret >= 0)
|
if (ret >= 0)
|
||||||
ret = size; /* consume everything, always */
|
ret = size; /* consume everything, always */
|
||||||
|
|
||||||
infault:
|
|
||||||
kfree(kbuf);
|
kfree(kbuf);
|
||||||
nomem:
|
|
||||||
_leave(" = %d", ret);
|
_leave(" = %d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,7 @@ EXPORT_SYMBOL(make_bad_inode);
|
|||||||
* Returns true if the inode in question has been marked as bad.
|
* Returns true if the inode in question has been marked as bad.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int is_bad_inode(struct inode *inode)
|
bool is_bad_inode(struct inode *inode)
|
||||||
{
|
{
|
||||||
return (inode->i_op == &bad_inode_ops);
|
return (inode->i_op == &bad_inode_ops);
|
||||||
}
|
}
|
||||||
|
@ -1042,12 +1042,9 @@ EXPORT_SYMBOL_GPL(bd_unlink_disk_holder);
|
|||||||
static void flush_disk(struct block_device *bdev, bool kill_dirty)
|
static void flush_disk(struct block_device *bdev, bool kill_dirty)
|
||||||
{
|
{
|
||||||
if (__invalidate_device(bdev, kill_dirty)) {
|
if (__invalidate_device(bdev, kill_dirty)) {
|
||||||
char name[BDEVNAME_SIZE] = "";
|
|
||||||
|
|
||||||
if (bdev->bd_disk)
|
|
||||||
disk_name(bdev->bd_disk, 0, name);
|
|
||||||
printk(KERN_WARNING "VFS: busy inodes on changed media or "
|
printk(KERN_WARNING "VFS: busy inodes on changed media or "
|
||||||
"resized disk %s\n", name);
|
"resized disk %s\n",
|
||||||
|
bdev->bd_disk ? bdev->bd_disk->disk_name : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bdev->bd_disk)
|
if (!bdev->bd_disk)
|
||||||
@ -1071,12 +1068,9 @@ void check_disk_size_change(struct gendisk *disk, struct block_device *bdev)
|
|||||||
disk_size = (loff_t)get_capacity(disk) << 9;
|
disk_size = (loff_t)get_capacity(disk) << 9;
|
||||||
bdev_size = i_size_read(bdev->bd_inode);
|
bdev_size = i_size_read(bdev->bd_inode);
|
||||||
if (disk_size != bdev_size) {
|
if (disk_size != bdev_size) {
|
||||||
char name[BDEVNAME_SIZE];
|
|
||||||
|
|
||||||
disk_name(disk, 0, name);
|
|
||||||
printk(KERN_INFO
|
printk(KERN_INFO
|
||||||
"%s: detected capacity change from %lld to %lld\n",
|
"%s: detected capacity change from %lld to %lld\n",
|
||||||
name, bdev_size, disk_size);
|
disk->disk_name, bdev_size, disk_size);
|
||||||
i_size_write(bdev->bd_inode, disk_size);
|
i_size_write(bdev->bd_inode, disk_size);
|
||||||
flush_disk(bdev, false);
|
flush_disk(bdev, false);
|
||||||
}
|
}
|
||||||
|
@ -1514,9 +1514,7 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags,
|
|||||||
if ((flags ^ s->s_flags) & MS_RDONLY)
|
if ((flags ^ s->s_flags) & MS_RDONLY)
|
||||||
error = -EBUSY;
|
error = -EBUSY;
|
||||||
} else {
|
} else {
|
||||||
char b[BDEVNAME_SIZE];
|
snprintf(s->s_id, sizeof(s->s_id), "%pg", bdev);
|
||||||
|
|
||||||
strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id));
|
|
||||||
btrfs_sb(s)->bdev_holder = fs_type;
|
btrfs_sb(s)->bdev_holder = fs_type;
|
||||||
error = btrfs_fill_super(s, fs_devices, data,
|
error = btrfs_fill_super(s, fs_devices, data,
|
||||||
flags & MS_SILENT ? 1 : 0);
|
flags & MS_SILENT ? 1 : 0);
|
||||||
|
21
fs/buffer.c
21
fs/buffer.c
@ -134,13 +134,10 @@ __clear_page_buffers(struct page *page)
|
|||||||
|
|
||||||
static void buffer_io_error(struct buffer_head *bh, char *msg)
|
static void buffer_io_error(struct buffer_head *bh, char *msg)
|
||||||
{
|
{
|
||||||
char b[BDEVNAME_SIZE];
|
|
||||||
|
|
||||||
if (!test_bit(BH_Quiet, &bh->b_state))
|
if (!test_bit(BH_Quiet, &bh->b_state))
|
||||||
printk_ratelimited(KERN_ERR
|
printk_ratelimited(KERN_ERR
|
||||||
"Buffer I/O error on dev %s, logical block %llu%s\n",
|
"Buffer I/O error on dev %pg, logical block %llu%s\n",
|
||||||
bdevname(bh->b_bdev, b),
|
bh->b_bdev, (unsigned long long)bh->b_blocknr, msg);
|
||||||
(unsigned long long)bh->b_blocknr, msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -237,15 +234,13 @@ __find_get_block_slow(struct block_device *bdev, sector_t block)
|
|||||||
* elsewhere, don't buffer_error if we had some unmapped buffers
|
* elsewhere, don't buffer_error if we had some unmapped buffers
|
||||||
*/
|
*/
|
||||||
if (all_mapped) {
|
if (all_mapped) {
|
||||||
char b[BDEVNAME_SIZE];
|
|
||||||
|
|
||||||
printk("__find_get_block_slow() failed. "
|
printk("__find_get_block_slow() failed. "
|
||||||
"block=%llu, b_blocknr=%llu\n",
|
"block=%llu, b_blocknr=%llu\n",
|
||||||
(unsigned long long)block,
|
(unsigned long long)block,
|
||||||
(unsigned long long)bh->b_blocknr);
|
(unsigned long long)bh->b_blocknr);
|
||||||
printk("b_state=0x%08lx, b_size=%zu\n",
|
printk("b_state=0x%08lx, b_size=%zu\n",
|
||||||
bh->b_state, bh->b_size);
|
bh->b_state, bh->b_size);
|
||||||
printk("device %s blocksize: %d\n", bdevname(bdev, b),
|
printk("device %pg blocksize: %d\n", bdev,
|
||||||
1 << bd_inode->i_blkbits);
|
1 << bd_inode->i_blkbits);
|
||||||
}
|
}
|
||||||
out_unlock:
|
out_unlock:
|
||||||
@ -531,10 +526,8 @@ static int osync_buffers_list(spinlock_t *lock, struct list_head *list)
|
|||||||
|
|
||||||
static void do_thaw_one(struct super_block *sb, void *unused)
|
static void do_thaw_one(struct super_block *sb, void *unused)
|
||||||
{
|
{
|
||||||
char b[BDEVNAME_SIZE];
|
|
||||||
while (sb->s_bdev && !thaw_bdev(sb->s_bdev, sb))
|
while (sb->s_bdev && !thaw_bdev(sb->s_bdev, sb))
|
||||||
printk(KERN_WARNING "Emergency Thaw on %s\n",
|
printk(KERN_WARNING "Emergency Thaw on %pg\n", sb->s_bdev);
|
||||||
bdevname(sb->s_bdev, b));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_thaw_all(struct work_struct *work)
|
static void do_thaw_all(struct work_struct *work)
|
||||||
@ -1074,12 +1067,10 @@ grow_buffers(struct block_device *bdev, sector_t block, int size, gfp_t gfp)
|
|||||||
* pagecache index. (this comparison is done using sector_t types).
|
* pagecache index. (this comparison is done using sector_t types).
|
||||||
*/
|
*/
|
||||||
if (unlikely(index != block >> sizebits)) {
|
if (unlikely(index != block >> sizebits)) {
|
||||||
char b[BDEVNAME_SIZE];
|
|
||||||
|
|
||||||
printk(KERN_ERR "%s: requested out-of-range block %llu for "
|
printk(KERN_ERR "%s: requested out-of-range block %llu for "
|
||||||
"device %s\n",
|
"device %pg\n",
|
||||||
__func__, (unsigned long long)block,
|
__func__, (unsigned long long)block,
|
||||||
bdevname(bdev, b));
|
bdev);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,15 +226,9 @@ static ssize_t cachefiles_daemon_write(struct file *file,
|
|||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
/* drag the command string into the kernel so we can parse it */
|
/* drag the command string into the kernel so we can parse it */
|
||||||
data = kmalloc(datalen + 1, GFP_KERNEL);
|
data = memdup_user_nul(_data, datalen);
|
||||||
if (!data)
|
if (IS_ERR(data))
|
||||||
return -ENOMEM;
|
return PTR_ERR(data);
|
||||||
|
|
||||||
ret = -EFAULT;
|
|
||||||
if (copy_from_user(data, _data, datalen) != 0)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
data[datalen] = '\0';
|
|
||||||
|
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
if (memchr(data, '\0', datalen))
|
if (memchr(data, '\0', datalen))
|
||||||
|
21
fs/compat.c
21
fs/compat.c
@ -792,7 +792,7 @@ COMPAT_SYSCALL_DEFINE5(mount, const char __user *, dev_name,
|
|||||||
const void __user *, data)
|
const void __user *, data)
|
||||||
{
|
{
|
||||||
char *kernel_type;
|
char *kernel_type;
|
||||||
unsigned long data_page;
|
void *options;
|
||||||
char *kernel_dev;
|
char *kernel_dev;
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
@ -806,26 +806,25 @@ COMPAT_SYSCALL_DEFINE5(mount, const char __user *, dev_name,
|
|||||||
if (IS_ERR(kernel_dev))
|
if (IS_ERR(kernel_dev))
|
||||||
goto out1;
|
goto out1;
|
||||||
|
|
||||||
retval = copy_mount_options(data, &data_page);
|
options = copy_mount_options(data);
|
||||||
if (retval < 0)
|
retval = PTR_ERR(options);
|
||||||
|
if (IS_ERR(options))
|
||||||
goto out2;
|
goto out2;
|
||||||
|
|
||||||
retval = -EINVAL;
|
if (kernel_type && options) {
|
||||||
|
|
||||||
if (kernel_type && data_page) {
|
|
||||||
if (!strcmp(kernel_type, NCPFS_NAME)) {
|
if (!strcmp(kernel_type, NCPFS_NAME)) {
|
||||||
do_ncp_super_data_conv((void *)data_page);
|
do_ncp_super_data_conv(options);
|
||||||
} else if (!strcmp(kernel_type, NFS4_NAME)) {
|
} else if (!strcmp(kernel_type, NFS4_NAME)) {
|
||||||
if (do_nfs4_super_data_conv((void *) data_page))
|
retval = -EINVAL;
|
||||||
|
if (do_nfs4_super_data_conv(options))
|
||||||
goto out3;
|
goto out3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
retval = do_mount(kernel_dev, dir_name, kernel_type,
|
retval = do_mount(kernel_dev, dir_name, kernel_type, flags, options);
|
||||||
flags, (void*)data_page);
|
|
||||||
|
|
||||||
out3:
|
out3:
|
||||||
free_page(data_page);
|
kfree(options);
|
||||||
out2:
|
out2:
|
||||||
kfree(kernel_dev);
|
kfree(kernel_dev);
|
||||||
out1:
|
out1:
|
||||||
|
@ -1305,12 +1305,6 @@ COMPATIBLE_IOCTL(PCIIOC_CONTROLLER)
|
|||||||
COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_IO)
|
COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_IO)
|
||||||
COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_MEM)
|
COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_MEM)
|
||||||
COMPATIBLE_IOCTL(PCIIOC_WRITE_COMBINE)
|
COMPATIBLE_IOCTL(PCIIOC_WRITE_COMBINE)
|
||||||
/* NBD */
|
|
||||||
COMPATIBLE_IOCTL(NBD_DO_IT)
|
|
||||||
COMPATIBLE_IOCTL(NBD_CLEAR_SOCK)
|
|
||||||
COMPATIBLE_IOCTL(NBD_CLEAR_QUE)
|
|
||||||
COMPATIBLE_IOCTL(NBD_PRINT_DEBUG)
|
|
||||||
COMPATIBLE_IOCTL(NBD_DISCONNECT)
|
|
||||||
/* i2c */
|
/* i2c */
|
||||||
COMPATIBLE_IOCTL(I2C_SLAVE)
|
COMPATIBLE_IOCTL(I2C_SLAVE)
|
||||||
COMPATIBLE_IOCTL(I2C_SLAVE_FORCE)
|
COMPATIBLE_IOCTL(I2C_SLAVE_FORCE)
|
||||||
@ -1529,11 +1523,6 @@ static long do_ioctl_trans(unsigned int cmd,
|
|||||||
case KDSKBMETA:
|
case KDSKBMETA:
|
||||||
case KDSKBLED:
|
case KDSKBLED:
|
||||||
case KDSETLED:
|
case KDSETLED:
|
||||||
/* NBD */
|
|
||||||
case NBD_SET_SOCK:
|
|
||||||
case NBD_SET_BLKSIZE:
|
|
||||||
case NBD_SET_SIZE:
|
|
||||||
case NBD_SET_SIZE_BLOCKS:
|
|
||||||
return vfs_ioctl(file, cmd, arg);
|
return vfs_ioctl(file, cmd, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include <linux/pipe_fs_i.h>
|
#include <linux/pipe_fs_i.h>
|
||||||
#include <linux/oom.h>
|
#include <linux/oom.h>
|
||||||
#include <linux/compat.h>
|
#include <linux/compat.h>
|
||||||
|
#include <linux/timekeeping.h>
|
||||||
|
|
||||||
#include <asm/uaccess.h>
|
#include <asm/uaccess.h>
|
||||||
#include <asm/mmu_context.h>
|
#include <asm/mmu_context.h>
|
||||||
@ -232,9 +233,10 @@ static int format_corename(struct core_name *cn, struct coredump_params *cprm)
|
|||||||
break;
|
break;
|
||||||
/* UNIX time of coredump */
|
/* UNIX time of coredump */
|
||||||
case 't': {
|
case 't': {
|
||||||
struct timeval tv;
|
time64_t time;
|
||||||
do_gettimeofday(&tv);
|
|
||||||
err = cn_printf(cn, "%lu", tv.tv_sec);
|
time = ktime_get_real_seconds();
|
||||||
|
err = cn_printf(cn, "%lld", time);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* hostname */
|
/* hostname */
|
||||||
|
14
fs/dcache.c
14
fs/dcache.c
@ -3303,18 +3303,18 @@ SYSCALL_DEFINE2(getcwd, char __user *, buf, unsigned long, size)
|
|||||||
* @new_dentry: new dentry
|
* @new_dentry: new dentry
|
||||||
* @old_dentry: old dentry
|
* @old_dentry: old dentry
|
||||||
*
|
*
|
||||||
* Returns 1 if new_dentry is a subdirectory of the parent (at any depth).
|
* Returns true if new_dentry is a subdirectory of the parent (at any depth).
|
||||||
* Returns 0 otherwise.
|
* Returns false otherwise.
|
||||||
* Caller must ensure that "new_dentry" is pinned before calling is_subdir()
|
* Caller must ensure that "new_dentry" is pinned before calling is_subdir()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int is_subdir(struct dentry *new_dentry, struct dentry *old_dentry)
|
bool is_subdir(struct dentry *new_dentry, struct dentry *old_dentry)
|
||||||
{
|
{
|
||||||
int result;
|
bool result;
|
||||||
unsigned seq;
|
unsigned seq;
|
||||||
|
|
||||||
if (new_dentry == old_dentry)
|
if (new_dentry == old_dentry)
|
||||||
return 1;
|
return true;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
/* for restarting inner loop in case of seq retry */
|
/* for restarting inner loop in case of seq retry */
|
||||||
@ -3325,9 +3325,9 @@ int is_subdir(struct dentry *new_dentry, struct dentry *old_dentry)
|
|||||||
*/
|
*/
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
if (d_ancestor(old_dentry, new_dentry))
|
if (d_ancestor(old_dentry, new_dentry))
|
||||||
result = 1;
|
result = true;
|
||||||
else
|
else
|
||||||
result = 0;
|
result = false;
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
} while (read_seqretry(&rename_lock, seq));
|
} while (read_seqretry(&rename_lock, seq));
|
||||||
|
|
||||||
|
@ -515,14 +515,9 @@ static ssize_t device_write(struct file *file, const char __user *buf,
|
|||||||
if (count > sizeof(struct dlm_write_request) + DLM_RESNAME_MAXLEN)
|
if (count > sizeof(struct dlm_write_request) + DLM_RESNAME_MAXLEN)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
kbuf = kzalloc(count + 1, GFP_NOFS);
|
kbuf = memdup_user_nul(buf, count);
|
||||||
if (!kbuf)
|
if (!IS_ERR(kbuf))
|
||||||
return -ENOMEM;
|
return PTR_ERR(kbuf);
|
||||||
|
|
||||||
if (copy_from_user(kbuf, buf, count)) {
|
|
||||||
error = -EFAULT;
|
|
||||||
goto out_free;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (check_version(kbuf)) {
|
if (check_version(kbuf)) {
|
||||||
error = -EBADE;
|
error = -EBADE;
|
||||||
|
@ -282,9 +282,7 @@ ecryptfs_create(struct inode *directory_inode, struct dentry *ecryptfs_dentry,
|
|||||||
if (rc) {
|
if (rc) {
|
||||||
ecryptfs_do_unlink(directory_inode, ecryptfs_dentry,
|
ecryptfs_do_unlink(directory_inode, ecryptfs_dentry,
|
||||||
ecryptfs_inode);
|
ecryptfs_inode);
|
||||||
make_bad_inode(ecryptfs_inode);
|
iget_failed(ecryptfs_inode);
|
||||||
unlock_new_inode(ecryptfs_inode);
|
|
||||||
iput(ecryptfs_inode);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
unlock_new_inode(ecryptfs_inode);
|
unlock_new_inode(ecryptfs_inode);
|
||||||
|
@ -119,7 +119,7 @@ SYSCALL_DEFINE1(uselib, const char __user *, library)
|
|||||||
int error = PTR_ERR(tmp);
|
int error = PTR_ERR(tmp);
|
||||||
static const struct open_flags uselib_flags = {
|
static const struct open_flags uselib_flags = {
|
||||||
.open_flag = O_LARGEFILE | O_RDONLY | __FMODE_EXEC,
|
.open_flag = O_LARGEFILE | O_RDONLY | __FMODE_EXEC,
|
||||||
.acc_mode = MAY_READ | MAY_EXEC | MAY_OPEN,
|
.acc_mode = MAY_READ | MAY_EXEC,
|
||||||
.intent = LOOKUP_OPEN,
|
.intent = LOOKUP_OPEN,
|
||||||
.lookup_flags = LOOKUP_FOLLOW,
|
.lookup_flags = LOOKUP_FOLLOW,
|
||||||
};
|
};
|
||||||
@ -763,7 +763,7 @@ static struct file *do_open_execat(int fd, struct filename *name, int flags)
|
|||||||
int err;
|
int err;
|
||||||
struct open_flags open_exec_flags = {
|
struct open_flags open_exec_flags = {
|
||||||
.open_flag = O_LARGEFILE | O_RDONLY | __FMODE_EXEC,
|
.open_flag = O_LARGEFILE | O_RDONLY | __FMODE_EXEC,
|
||||||
.acc_mode = MAY_EXEC | MAY_OPEN,
|
.acc_mode = MAY_EXEC,
|
||||||
.intent = LOOKUP_OPEN,
|
.intent = LOOKUP_OPEN,
|
||||||
.lookup_flags = LOOKUP_FOLLOW,
|
.lookup_flags = LOOKUP_FOLLOW,
|
||||||
};
|
};
|
||||||
|
@ -77,10 +77,8 @@
|
|||||||
printk("\n"); \
|
printk("\n"); \
|
||||||
} while (0)
|
} while (0)
|
||||||
# define ea_bdebug(bh, f...) do { \
|
# define ea_bdebug(bh, f...) do { \
|
||||||
char b[BDEVNAME_SIZE]; \
|
printk(KERN_DEBUG "block %pg:%lu: ", \
|
||||||
printk(KERN_DEBUG "block %s:%lu: ", \
|
bh->b_bdev, (unsigned long) bh->b_blocknr); \
|
||||||
bdevname(bh->b_bdev, b), \
|
|
||||||
(unsigned long) bh->b_blocknr); \
|
|
||||||
printk(f); \
|
printk(f); \
|
||||||
printk("\n"); \
|
printk("\n"); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
@ -52,9 +52,8 @@ void ext4_exit_pageio(void)
|
|||||||
*/
|
*/
|
||||||
static void buffer_io_error(struct buffer_head *bh)
|
static void buffer_io_error(struct buffer_head *bh)
|
||||||
{
|
{
|
||||||
char b[BDEVNAME_SIZE];
|
printk_ratelimited(KERN_ERR "Buffer I/O error on device %pg, logical block %llu\n",
|
||||||
printk_ratelimited(KERN_ERR "Buffer I/O error on device %s, logical block %llu\n",
|
bh->b_bdev,
|
||||||
bdevname(bh->b_bdev, b),
|
|
||||||
(unsigned long long)bh->b_blocknr);
|
(unsigned long long)bh->b_blocknr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,10 +68,8 @@
|
|||||||
printk("\n"); \
|
printk("\n"); \
|
||||||
} while (0)
|
} while (0)
|
||||||
# define ea_bdebug(bh, f...) do { \
|
# define ea_bdebug(bh, f...) do { \
|
||||||
char b[BDEVNAME_SIZE]; \
|
printk(KERN_DEBUG "block %pg:%lu: ", \
|
||||||
printk(KERN_DEBUG "block %s:%lu: ", \
|
bh->b_bdev, (unsigned long) bh->b_blocknr); \
|
||||||
bdevname(bh->b_bdev, b), \
|
|
||||||
(unsigned long) bh->b_blocknr); \
|
|
||||||
printk(f); \
|
printk(f); \
|
||||||
printk("\n"); \
|
printk("\n"); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
@ -211,12 +211,10 @@ static int stat_show(struct seq_file *s, void *v)
|
|||||||
|
|
||||||
mutex_lock(&f2fs_stat_mutex);
|
mutex_lock(&f2fs_stat_mutex);
|
||||||
list_for_each_entry(si, &f2fs_stat_list, stat_list) {
|
list_for_each_entry(si, &f2fs_stat_list, stat_list) {
|
||||||
char devname[BDEVNAME_SIZE];
|
|
||||||
|
|
||||||
update_general_status(si->sbi);
|
update_general_status(si->sbi);
|
||||||
|
|
||||||
seq_printf(s, "\n=====[ partition info(%s). #%d ]=====\n",
|
seq_printf(s, "\n=====[ partition info(%pg). #%d ]=====\n",
|
||||||
bdevname(si->sbi->sb->s_bdev, devname), i++);
|
si->sbi->sb->s_bdev, i++);
|
||||||
seq_printf(s, "[SB: 1] [CP: 2] [SIT: %d] [NAT: %d] ",
|
seq_printf(s, "[SB: 1] [CP: 2] [SIT: %d] [NAT: %d] ",
|
||||||
si->sit_area_segs, si->nat_area_segs);
|
si->sit_area_segs, si->nat_area_segs);
|
||||||
seq_printf(s, "[SSA: %d] [MAIN: %d",
|
seq_printf(s, "[SSA: %d] [MAIN: %d",
|
||||||
|
@ -1602,13 +1602,11 @@ static inline bool is_dot_dotdot(const struct qstr *str)
|
|||||||
|
|
||||||
static inline bool f2fs_may_extent_tree(struct inode *inode)
|
static inline bool f2fs_may_extent_tree(struct inode *inode)
|
||||||
{
|
{
|
||||||
mode_t mode = inode->i_mode;
|
|
||||||
|
|
||||||
if (!test_opt(F2FS_I_SB(inode), EXTENT_CACHE) ||
|
if (!test_opt(F2FS_I_SB(inode), EXTENT_CACHE) ||
|
||||||
is_inode_flag_set(F2FS_I(inode), FI_NO_EXTENT))
|
is_inode_flag_set(F2FS_I(inode), FI_NO_EXTENT))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return S_ISREG(mode);
|
return S_ISREG(inode->i_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void *f2fs_kvmalloc(size_t size, gfp_t flags)
|
static inline void *f2fs_kvmalloc(size_t size, gfp_t flags)
|
||||||
@ -2121,7 +2119,7 @@ static inline int f2fs_sb_has_crypto(struct super_block *sb)
|
|||||||
static inline bool f2fs_may_encrypt(struct inode *inode)
|
static inline bool f2fs_may_encrypt(struct inode *inode)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_F2FS_FS_ENCRYPTION
|
#ifdef CONFIG_F2FS_FS_ENCRYPTION
|
||||||
mode_t mode = inode->i_mode;
|
umode_t mode = inode->i_mode;
|
||||||
|
|
||||||
return (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode));
|
return (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode));
|
||||||
#else
|
#else
|
||||||
|
@ -51,7 +51,8 @@ static int setfl(int fd, struct file * filp, unsigned long arg)
|
|||||||
if (arg & O_NDELAY)
|
if (arg & O_NDELAY)
|
||||||
arg |= O_NONBLOCK;
|
arg |= O_NONBLOCK;
|
||||||
|
|
||||||
if (arg & O_DIRECT) {
|
/* Pipe packetized mode is controlled by O_DIRECT flag */
|
||||||
|
if (!S_ISFIFO(filp->f_inode->i_mode) && (arg & O_DIRECT)) {
|
||||||
if (!filp->f_mapping || !filp->f_mapping->a_ops ||
|
if (!filp->f_mapping || !filp->f_mapping->a_ops ||
|
||||||
!filp->f_mapping->a_ops->direct_IO)
|
!filp->f_mapping->a_ops->direct_IO)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -25,9 +25,9 @@
|
|||||||
|
|
||||||
int sysctl_nr_open __read_mostly = 1024*1024;
|
int sysctl_nr_open __read_mostly = 1024*1024;
|
||||||
int sysctl_nr_open_min = BITS_PER_LONG;
|
int sysctl_nr_open_min = BITS_PER_LONG;
|
||||||
/* our max() is unusable in constant expressions ;-/ */
|
/* our min() is unusable in constant expressions ;-/ */
|
||||||
#define __const_max(x, y) ((x) < (y) ? (x) : (y))
|
#define __const_min(x, y) ((x) < (y) ? (x) : (y))
|
||||||
int sysctl_nr_open_max = __const_max(INT_MAX, ~(size_t)0/sizeof(void *)) &
|
int sysctl_nr_open_max = __const_min(INT_MAX, ~(size_t)0/sizeof(void *)) &
|
||||||
-BITS_PER_LONG;
|
-BITS_PER_LONG;
|
||||||
|
|
||||||
static void *alloc_fdmem(size_t size)
|
static void *alloc_fdmem(size_t size)
|
||||||
|
@ -1315,9 +1315,7 @@ static struct dentry *gfs2_mount(struct file_system_type *fs_type, int flags,
|
|||||||
if ((flags ^ s->s_flags) & MS_RDONLY)
|
if ((flags ^ s->s_flags) & MS_RDONLY)
|
||||||
goto error_super;
|
goto error_super;
|
||||||
} else {
|
} else {
|
||||||
char b[BDEVNAME_SIZE];
|
snprintf(s->s_id, sizeof(s->s_id), "%pg", bdev);
|
||||||
|
|
||||||
strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id));
|
|
||||||
sb_set_blocksize(s, block_size(bdev));
|
sb_set_blocksize(s, block_size(bdev));
|
||||||
error = fill_super(s, &args, flags & MS_SILENT ? 1 : 0);
|
error = fill_super(s, &args, flags & MS_SILENT ? 1 : 0);
|
||||||
if (error)
|
if (error)
|
||||||
|
@ -166,7 +166,7 @@ int hfs_mdb_get(struct super_block *sb)
|
|||||||
pr_warn("continuing without an alternate MDB\n");
|
pr_warn("continuing without an alternate MDB\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
HFS_SB(sb)->bitmap = (__be32 *)__get_free_pages(GFP_KERNEL, PAGE_SIZE < 8192 ? 1 : 0);
|
HFS_SB(sb)->bitmap = kmalloc(8192, GFP_KERNEL);
|
||||||
if (!HFS_SB(sb)->bitmap)
|
if (!HFS_SB(sb)->bitmap)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
@ -360,7 +360,7 @@ void hfs_mdb_put(struct super_block *sb)
|
|||||||
unload_nls(HFS_SB(sb)->nls_io);
|
unload_nls(HFS_SB(sb)->nls_io);
|
||||||
unload_nls(HFS_SB(sb)->nls_disk);
|
unload_nls(HFS_SB(sb)->nls_disk);
|
||||||
|
|
||||||
free_pages((unsigned long)HFS_SB(sb)->bitmap, PAGE_SIZE < 8192 ? 1 : 0);
|
kfree(HFS_SB(sb)->bitmap);
|
||||||
kfree(HFS_SB(sb));
|
kfree(HFS_SB(sb));
|
||||||
sb->s_fs_info = NULL;
|
sb->s_fs_info = NULL;
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ __le32 *hpfs_load_bitmap_directory(struct super_block *s, secno bmp)
|
|||||||
void hpfs_load_hotfix_map(struct super_block *s, struct hpfs_spare_block *spareblock)
|
void hpfs_load_hotfix_map(struct super_block *s, struct hpfs_spare_block *spareblock)
|
||||||
{
|
{
|
||||||
struct quad_buffer_head qbh;
|
struct quad_buffer_head qbh;
|
||||||
u32 *directory;
|
__le32 *directory;
|
||||||
u32 n_hotfixes, n_used_hotfixes;
|
u32 n_hotfixes, n_used_hotfixes;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ extern int vfs_path_lookup(struct dentry *, struct vfsmount *,
|
|||||||
/*
|
/*
|
||||||
* namespace.c
|
* namespace.c
|
||||||
*/
|
*/
|
||||||
extern int copy_mount_options(const void __user *, unsigned long *);
|
extern void *copy_mount_options(const void __user *);
|
||||||
extern char *copy_mount_string(const void __user *);
|
extern char *copy_mount_string(const void __user *);
|
||||||
|
|
||||||
extern struct vfsmount *lookup_mnt(struct path *);
|
extern struct vfsmount *lookup_mnt(struct path *);
|
||||||
|
@ -764,13 +764,11 @@ void jbd2_journal_unlock_updates (journal_t *journal)
|
|||||||
|
|
||||||
static void warn_dirty_buffer(struct buffer_head *bh)
|
static void warn_dirty_buffer(struct buffer_head *bh)
|
||||||
{
|
{
|
||||||
char b[BDEVNAME_SIZE];
|
|
||||||
|
|
||||||
printk(KERN_WARNING
|
printk(KERN_WARNING
|
||||||
"JBD2: Spotted dirty metadata buffer (dev = %s, blocknr = %llu). "
|
"JBD2: Spotted dirty metadata buffer (dev = %pg, blocknr = %llu). "
|
||||||
"There's a risk of filesystem corruption in case of system "
|
"There's a risk of filesystem corruption in case of system "
|
||||||
"crash.\n",
|
"crash.\n",
|
||||||
bdevname(bh->b_bdev, b), (unsigned long long)bh->b_blocknr);
|
bh->b_bdev, (unsigned long long)bh->b_blocknr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Call t_frozen trigger and copy buffer data into jh->b_frozen_data. */
|
/* Call t_frozen trigger and copy buffer data into jh->b_frozen_data. */
|
||||||
|
@ -1835,17 +1835,16 @@ static int lbmLogInit(struct jfs_log * log)
|
|||||||
for (i = 0; i < LOGPAGES;) {
|
for (i = 0; i < LOGPAGES;) {
|
||||||
char *buffer;
|
char *buffer;
|
||||||
uint offset;
|
uint offset;
|
||||||
struct page *page;
|
struct page *page = alloc_page(GFP_KERNEL | __GFP_ZERO);
|
||||||
|
|
||||||
buffer = (char *) get_zeroed_page(GFP_KERNEL);
|
if (!page)
|
||||||
if (buffer == NULL)
|
|
||||||
goto error;
|
goto error;
|
||||||
page = virt_to_page(buffer);
|
buffer = page_address(page);
|
||||||
for (offset = 0; offset < PAGE_SIZE; offset += LOGPSIZE) {
|
for (offset = 0; offset < PAGE_SIZE; offset += LOGPSIZE) {
|
||||||
lbuf = kmalloc(sizeof(struct lbuf), GFP_KERNEL);
|
lbuf = kmalloc(sizeof(struct lbuf), GFP_KERNEL);
|
||||||
if (lbuf == NULL) {
|
if (lbuf == NULL) {
|
||||||
if (offset == 0)
|
if (offset == 0)
|
||||||
free_page((unsigned long) buffer);
|
__free_page(page);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (offset) /* we already have one reference */
|
if (offset) /* we already have one reference */
|
||||||
|
@ -302,7 +302,7 @@ struct logfs_block {
|
|||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
struct logfs_transaction *ta;
|
struct logfs_transaction *ta;
|
||||||
unsigned long alias_map[LOGFS_BLOCK_FACTOR / BITS_PER_LONG];
|
unsigned long alias_map[LOGFS_BLOCK_FACTOR / BITS_PER_LONG];
|
||||||
struct logfs_block_ops *ops;
|
const struct logfs_block_ops *ops;
|
||||||
int full;
|
int full;
|
||||||
int partial;
|
int partial;
|
||||||
int reserved_bytes;
|
int reserved_bytes;
|
||||||
@ -578,7 +578,7 @@ int logfs_exist_block(struct inode *inode, u64 bix);
|
|||||||
int get_page_reserve(struct inode *inode, struct page *page);
|
int get_page_reserve(struct inode *inode, struct page *page);
|
||||||
void logfs_get_wblocks(struct super_block *sb, struct page *page, int lock);
|
void logfs_get_wblocks(struct super_block *sb, struct page *page, int lock);
|
||||||
void logfs_put_wblocks(struct super_block *sb, struct page *page, int lock);
|
void logfs_put_wblocks(struct super_block *sb, struct page *page, int lock);
|
||||||
extern struct logfs_block_ops indirect_block_ops;
|
extern const struct logfs_block_ops indirect_block_ops;
|
||||||
|
|
||||||
/* segment.c */
|
/* segment.c */
|
||||||
int logfs_erase_segment(struct super_block *sb, u32 ofs, int ensure_erase);
|
int logfs_erase_segment(struct super_block *sb, u32 ofs, int ensure_erase);
|
||||||
|
@ -569,13 +569,13 @@ static void indirect_free_block(struct super_block *sb,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct logfs_block_ops inode_block_ops = {
|
static const struct logfs_block_ops inode_block_ops = {
|
||||||
.write_block = inode_write_block,
|
.write_block = inode_write_block,
|
||||||
.free_block = inode_free_block,
|
.free_block = inode_free_block,
|
||||||
.write_alias = inode_write_alias,
|
.write_alias = inode_write_alias,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct logfs_block_ops indirect_block_ops = {
|
const struct logfs_block_ops indirect_block_ops = {
|
||||||
.write_block = indirect_write_block,
|
.write_block = indirect_write_block,
|
||||||
.free_block = indirect_free_block,
|
.free_block = indirect_free_block,
|
||||||
.write_alias = indirect_write_alias,
|
.write_alias = indirect_write_alias,
|
||||||
|
@ -197,7 +197,7 @@ static int btree_write_alias(struct super_block *sb, struct logfs_block *block,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct logfs_block_ops btree_block_ops = {
|
static const struct logfs_block_ops btree_block_ops = {
|
||||||
.write_block = btree_write_block,
|
.write_block = btree_write_block,
|
||||||
.free_block = __free_block,
|
.free_block = __free_block,
|
||||||
.write_alias = btree_write_alias,
|
.write_alias = btree_write_alias,
|
||||||
|
@ -24,16 +24,15 @@ static inline block_t *i_data(struct inode *inode)
|
|||||||
static int block_to_path(struct inode * inode, long block, int offsets[DEPTH])
|
static int block_to_path(struct inode * inode, long block, int offsets[DEPTH])
|
||||||
{
|
{
|
||||||
int n = 0;
|
int n = 0;
|
||||||
char b[BDEVNAME_SIZE];
|
|
||||||
|
|
||||||
if (block < 0) {
|
if (block < 0) {
|
||||||
printk("MINIX-fs: block_to_path: block %ld < 0 on dev %s\n",
|
printk("MINIX-fs: block_to_path: block %ld < 0 on dev %pg\n",
|
||||||
block, bdevname(inode->i_sb->s_bdev, b));
|
block, inode->i_sb->s_bdev);
|
||||||
} else if (block >= (minix_sb(inode->i_sb)->s_max_size/BLOCK_SIZE)) {
|
} else if (block >= (minix_sb(inode->i_sb)->s_max_size/BLOCK_SIZE)) {
|
||||||
if (printk_ratelimit())
|
if (printk_ratelimit())
|
||||||
printk("MINIX-fs: block_to_path: "
|
printk("MINIX-fs: block_to_path: "
|
||||||
"block %ld too big on dev %s\n",
|
"block %ld too big on dev %pg\n",
|
||||||
block, bdevname(inode->i_sb->s_bdev, b));
|
block, inode->i_sb->s_bdev);
|
||||||
} else if (block < 7) {
|
} else if (block < 7) {
|
||||||
offsets[n++] = block;
|
offsets[n++] = block;
|
||||||
} else if ((block -= 7) < 512) {
|
} else if ((block -= 7) < 512) {
|
||||||
|
@ -26,18 +26,17 @@ static inline block_t *i_data(struct inode *inode)
|
|||||||
static int block_to_path(struct inode * inode, long block, int offsets[DEPTH])
|
static int block_to_path(struct inode * inode, long block, int offsets[DEPTH])
|
||||||
{
|
{
|
||||||
int n = 0;
|
int n = 0;
|
||||||
char b[BDEVNAME_SIZE];
|
|
||||||
struct super_block *sb = inode->i_sb;
|
struct super_block *sb = inode->i_sb;
|
||||||
|
|
||||||
if (block < 0) {
|
if (block < 0) {
|
||||||
printk("MINIX-fs: block_to_path: block %ld < 0 on dev %s\n",
|
printk("MINIX-fs: block_to_path: block %ld < 0 on dev %pg\n",
|
||||||
block, bdevname(sb->s_bdev, b));
|
block, sb->s_bdev);
|
||||||
} else if ((u64)block * (u64)sb->s_blocksize >=
|
} else if ((u64)block * (u64)sb->s_blocksize >=
|
||||||
minix_sb(sb)->s_max_size) {
|
minix_sb(sb)->s_max_size) {
|
||||||
if (printk_ratelimit())
|
if (printk_ratelimit())
|
||||||
printk("MINIX-fs: block_to_path: "
|
printk("MINIX-fs: block_to_path: "
|
||||||
"block %ld too big on dev %s\n",
|
"block %ld too big on dev %pg\n",
|
||||||
block, bdevname(sb->s_bdev, b));
|
block, sb->s_bdev);
|
||||||
} else if (block < DIRCOUNT) {
|
} else if (block < DIRCOUNT) {
|
||||||
offsets[n++] = block;
|
offsets[n++] = block;
|
||||||
} else if ((block -= DIRCOUNT) < INDIRCOUNT(sb)) {
|
} else if ((block -= DIRCOUNT) < INDIRCOUNT(sb)) {
|
||||||
|
200
fs/namei.c
200
fs/namei.c
@ -534,10 +534,8 @@ static void restore_nameidata(void)
|
|||||||
current->nameidata = old;
|
current->nameidata = old;
|
||||||
if (old)
|
if (old)
|
||||||
old->total_link_count = now->total_link_count;
|
old->total_link_count = now->total_link_count;
|
||||||
if (now->stack != now->internal) {
|
if (now->stack != now->internal)
|
||||||
kfree(now->stack);
|
kfree(now->stack);
|
||||||
now->stack = now->internal;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __nd_alloc_stack(struct nameidata *nd)
|
static int __nd_alloc_stack(struct nameidata *nd)
|
||||||
@ -654,7 +652,7 @@ static bool legitimize_links(struct nameidata *nd)
|
|||||||
* Path walking has 2 modes, rcu-walk and ref-walk (see
|
* Path walking has 2 modes, rcu-walk and ref-walk (see
|
||||||
* Documentation/filesystems/path-lookup.txt). In situations when we can't
|
* Documentation/filesystems/path-lookup.txt). In situations when we can't
|
||||||
* continue in RCU mode, we attempt to drop out of rcu-walk mode and grab
|
* continue in RCU mode, we attempt to drop out of rcu-walk mode and grab
|
||||||
* normal reference counts on dentries and vfsmounts to transition to rcu-walk
|
* normal reference counts on dentries and vfsmounts to transition to ref-walk
|
||||||
* mode. Refcounts are grabbed at the last known good point before rcu-walk
|
* mode. Refcounts are grabbed at the last known good point before rcu-walk
|
||||||
* got stuck, so ref-walk may continue from there. If this is not successful
|
* got stuck, so ref-walk may continue from there. If this is not successful
|
||||||
* (eg. a seqcount has changed), then failure is returned and it's up to caller
|
* (eg. a seqcount has changed), then failure is returned and it's up to caller
|
||||||
@ -803,20 +801,20 @@ static int complete_walk(struct nameidata *nd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void set_root(struct nameidata *nd)
|
static void set_root(struct nameidata *nd)
|
||||||
{
|
|
||||||
get_fs_root(current->fs, &nd->root);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void set_root_rcu(struct nameidata *nd)
|
|
||||||
{
|
{
|
||||||
struct fs_struct *fs = current->fs;
|
struct fs_struct *fs = current->fs;
|
||||||
unsigned seq;
|
|
||||||
|
|
||||||
do {
|
if (nd->flags & LOOKUP_RCU) {
|
||||||
seq = read_seqcount_begin(&fs->seq);
|
unsigned seq;
|
||||||
nd->root = fs->root;
|
|
||||||
nd->root_seq = __read_seqcount_begin(&nd->root.dentry->d_seq);
|
do {
|
||||||
} while (read_seqcount_retry(&fs->seq, seq));
|
seq = read_seqcount_begin(&fs->seq);
|
||||||
|
nd->root = fs->root;
|
||||||
|
nd->root_seq = __read_seqcount_begin(&nd->root.dentry->d_seq);
|
||||||
|
} while (read_seqcount_retry(&fs->seq, seq));
|
||||||
|
} else {
|
||||||
|
get_fs_root(fs, &nd->root);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void path_put_conditional(struct path *path, struct nameidata *nd)
|
static void path_put_conditional(struct path *path, struct nameidata *nd)
|
||||||
@ -838,6 +836,26 @@ static inline void path_to_nameidata(const struct path *path,
|
|||||||
nd->path.dentry = path->dentry;
|
nd->path.dentry = path->dentry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int nd_jump_root(struct nameidata *nd)
|
||||||
|
{
|
||||||
|
if (nd->flags & LOOKUP_RCU) {
|
||||||
|
struct dentry *d;
|
||||||
|
nd->path = nd->root;
|
||||||
|
d = nd->path.dentry;
|
||||||
|
nd->inode = d->d_inode;
|
||||||
|
nd->seq = nd->root_seq;
|
||||||
|
if (unlikely(read_seqcount_retry(&d->d_seq, nd->seq)))
|
||||||
|
return -ECHILD;
|
||||||
|
} else {
|
||||||
|
path_put(&nd->path);
|
||||||
|
nd->path = nd->root;
|
||||||
|
path_get(&nd->path);
|
||||||
|
nd->inode = nd->path.dentry->d_inode;
|
||||||
|
}
|
||||||
|
nd->flags |= LOOKUP_JUMPED;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Helper to directly jump to a known parsed path from ->get_link,
|
* Helper to directly jump to a known parsed path from ->get_link,
|
||||||
* caller must have taken a reference to path beforehand.
|
* caller must have taken a reference to path beforehand.
|
||||||
@ -1016,25 +1034,10 @@ const char *get_link(struct nameidata *nd)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
if (*res == '/') {
|
if (*res == '/') {
|
||||||
if (nd->flags & LOOKUP_RCU) {
|
if (!nd->root.mnt)
|
||||||
struct dentry *d;
|
set_root(nd);
|
||||||
if (!nd->root.mnt)
|
if (unlikely(nd_jump_root(nd)))
|
||||||
set_root_rcu(nd);
|
return ERR_PTR(-ECHILD);
|
||||||
nd->path = nd->root;
|
|
||||||
d = nd->path.dentry;
|
|
||||||
nd->inode = d->d_inode;
|
|
||||||
nd->seq = nd->root_seq;
|
|
||||||
if (unlikely(read_seqcount_retry(&d->d_seq, nd->seq)))
|
|
||||||
return ERR_PTR(-ECHILD);
|
|
||||||
} else {
|
|
||||||
if (!nd->root.mnt)
|
|
||||||
set_root(nd);
|
|
||||||
path_put(&nd->path);
|
|
||||||
nd->path = nd->root;
|
|
||||||
path_get(&nd->root);
|
|
||||||
nd->inode = nd->path.dentry->d_inode;
|
|
||||||
}
|
|
||||||
nd->flags |= LOOKUP_JUMPED;
|
|
||||||
while (unlikely(*++res == '/'))
|
while (unlikely(*++res == '/'))
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
@ -1295,8 +1298,6 @@ static bool __follow_mount_rcu(struct nameidata *nd, struct path *path,
|
|||||||
static int follow_dotdot_rcu(struct nameidata *nd)
|
static int follow_dotdot_rcu(struct nameidata *nd)
|
||||||
{
|
{
|
||||||
struct inode *inode = nd->inode;
|
struct inode *inode = nd->inode;
|
||||||
if (!nd->root.mnt)
|
|
||||||
set_root_rcu(nd);
|
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (path_equal(&nd->path, &nd->root))
|
if (path_equal(&nd->path, &nd->root))
|
||||||
@ -1416,9 +1417,6 @@ static void follow_mount(struct path *path)
|
|||||||
|
|
||||||
static int follow_dotdot(struct nameidata *nd)
|
static int follow_dotdot(struct nameidata *nd)
|
||||||
{
|
{
|
||||||
if (!nd->root.mnt)
|
|
||||||
set_root(nd);
|
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
struct dentry *old = nd->path.dentry;
|
struct dentry *old = nd->path.dentry;
|
||||||
|
|
||||||
@ -1656,6 +1654,8 @@ static inline int may_lookup(struct nameidata *nd)
|
|||||||
static inline int handle_dots(struct nameidata *nd, int type)
|
static inline int handle_dots(struct nameidata *nd, int type)
|
||||||
{
|
{
|
||||||
if (type == LAST_DOTDOT) {
|
if (type == LAST_DOTDOT) {
|
||||||
|
if (!nd->root.mnt)
|
||||||
|
set_root(nd);
|
||||||
if (nd->flags & LOOKUP_RCU) {
|
if (nd->flags & LOOKUP_RCU) {
|
||||||
return follow_dotdot_rcu(nd);
|
return follow_dotdot_rcu(nd);
|
||||||
} else
|
} else
|
||||||
@ -2021,18 +2021,19 @@ static const char *path_init(struct nameidata *nd, unsigned flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nd->root.mnt = NULL;
|
nd->root.mnt = NULL;
|
||||||
|
nd->path.mnt = NULL;
|
||||||
|
nd->path.dentry = NULL;
|
||||||
|
|
||||||
nd->m_seq = read_seqbegin(&mount_lock);
|
nd->m_seq = read_seqbegin(&mount_lock);
|
||||||
if (*s == '/') {
|
if (*s == '/') {
|
||||||
if (flags & LOOKUP_RCU) {
|
if (flags & LOOKUP_RCU)
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
set_root_rcu(nd);
|
set_root(nd);
|
||||||
nd->seq = nd->root_seq;
|
if (likely(!nd_jump_root(nd)))
|
||||||
} else {
|
return s;
|
||||||
set_root(nd);
|
nd->root.mnt = NULL;
|
||||||
path_get(&nd->root);
|
rcu_read_unlock();
|
||||||
}
|
return ERR_PTR(-ECHILD);
|
||||||
nd->path = nd->root;
|
|
||||||
} else if (nd->dfd == AT_FDCWD) {
|
} else if (nd->dfd == AT_FDCWD) {
|
||||||
if (flags & LOOKUP_RCU) {
|
if (flags & LOOKUP_RCU) {
|
||||||
struct fs_struct *fs = current->fs;
|
struct fs_struct *fs = current->fs;
|
||||||
@ -2043,11 +2044,14 @@ static const char *path_init(struct nameidata *nd, unsigned flags)
|
|||||||
do {
|
do {
|
||||||
seq = read_seqcount_begin(&fs->seq);
|
seq = read_seqcount_begin(&fs->seq);
|
||||||
nd->path = fs->pwd;
|
nd->path = fs->pwd;
|
||||||
|
nd->inode = nd->path.dentry->d_inode;
|
||||||
nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq);
|
nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq);
|
||||||
} while (read_seqcount_retry(&fs->seq, seq));
|
} while (read_seqcount_retry(&fs->seq, seq));
|
||||||
} else {
|
} else {
|
||||||
get_fs_pwd(current->fs, &nd->path);
|
get_fs_pwd(current->fs, &nd->path);
|
||||||
|
nd->inode = nd->path.dentry->d_inode;
|
||||||
}
|
}
|
||||||
|
return s;
|
||||||
} else {
|
} else {
|
||||||
/* Caller must check execute permissions on the starting path component */
|
/* Caller must check execute permissions on the starting path component */
|
||||||
struct fd f = fdget_raw(nd->dfd);
|
struct fd f = fdget_raw(nd->dfd);
|
||||||
@ -2077,16 +2081,6 @@ static const char *path_init(struct nameidata *nd, unsigned flags)
|
|||||||
fdput(f);
|
fdput(f);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
nd->inode = nd->path.dentry->d_inode;
|
|
||||||
if (!(flags & LOOKUP_RCU))
|
|
||||||
return s;
|
|
||||||
if (likely(!read_seqcount_retry(&nd->path.dentry->d_seq, nd->seq)))
|
|
||||||
return s;
|
|
||||||
if (!(nd->flags & LOOKUP_ROOT))
|
|
||||||
nd->root.mnt = NULL;
|
|
||||||
rcu_read_unlock();
|
|
||||||
return ERR_PTR(-ECHILD);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *trailing_symlink(struct nameidata *nd)
|
static const char *trailing_symlink(struct nameidata *nd)
|
||||||
@ -2279,6 +2273,8 @@ EXPORT_SYMBOL(vfs_path_lookup);
|
|||||||
*
|
*
|
||||||
* Note that this routine is purely a helper for filesystem usage and should
|
* Note that this routine is purely a helper for filesystem usage and should
|
||||||
* not be called by generic code.
|
* not be called by generic code.
|
||||||
|
*
|
||||||
|
* The caller must hold base->i_mutex.
|
||||||
*/
|
*/
|
||||||
struct dentry *lookup_one_len(const char *name, struct dentry *base, int len)
|
struct dentry *lookup_one_len(const char *name, struct dentry *base, int len)
|
||||||
{
|
{
|
||||||
@ -2322,6 +2318,75 @@ struct dentry *lookup_one_len(const char *name, struct dentry *base, int len)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(lookup_one_len);
|
EXPORT_SYMBOL(lookup_one_len);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* lookup_one_len_unlocked - filesystem helper to lookup single pathname component
|
||||||
|
* @name: pathname component to lookup
|
||||||
|
* @base: base directory to lookup from
|
||||||
|
* @len: maximum length @len should be interpreted to
|
||||||
|
*
|
||||||
|
* Note that this routine is purely a helper for filesystem usage and should
|
||||||
|
* not be called by generic code.
|
||||||
|
*
|
||||||
|
* Unlike lookup_one_len, it should be called without the parent
|
||||||
|
* i_mutex held, and will take the i_mutex itself if necessary.
|
||||||
|
*/
|
||||||
|
struct dentry *lookup_one_len_unlocked(const char *name,
|
||||||
|
struct dentry *base, int len)
|
||||||
|
{
|
||||||
|
struct qstr this;
|
||||||
|
unsigned int c;
|
||||||
|
int err;
|
||||||
|
struct dentry *ret;
|
||||||
|
|
||||||
|
this.name = name;
|
||||||
|
this.len = len;
|
||||||
|
this.hash = full_name_hash(name, len);
|
||||||
|
if (!len)
|
||||||
|
return ERR_PTR(-EACCES);
|
||||||
|
|
||||||
|
if (unlikely(name[0] == '.')) {
|
||||||
|
if (len < 2 || (len == 2 && name[1] == '.'))
|
||||||
|
return ERR_PTR(-EACCES);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (len--) {
|
||||||
|
c = *(const unsigned char *)name++;
|
||||||
|
if (c == '/' || c == '\0')
|
||||||
|
return ERR_PTR(-EACCES);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* See if the low-level filesystem might want
|
||||||
|
* to use its own hash..
|
||||||
|
*/
|
||||||
|
if (base->d_flags & DCACHE_OP_HASH) {
|
||||||
|
int err = base->d_op->d_hash(base, &this);
|
||||||
|
if (err < 0)
|
||||||
|
return ERR_PTR(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
err = inode_permission(base->d_inode, MAY_EXEC);
|
||||||
|
if (err)
|
||||||
|
return ERR_PTR(err);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* __d_lookup() is used to try to get a quick answer and avoid the
|
||||||
|
* mutex. A false-negative does no harm.
|
||||||
|
*/
|
||||||
|
ret = __d_lookup(base, &this);
|
||||||
|
if (ret && unlikely(ret->d_flags & DCACHE_OP_REVALIDATE)) {
|
||||||
|
dput(ret);
|
||||||
|
ret = NULL;
|
||||||
|
}
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
mutex_lock(&base->d_inode->i_mutex);
|
||||||
|
ret = __lookup_hash(&this, base, 0);
|
||||||
|
mutex_unlock(&base->d_inode->i_mutex);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(lookup_one_len_unlocked);
|
||||||
|
|
||||||
int user_path_at_empty(int dfd, const char __user *name, unsigned flags,
|
int user_path_at_empty(int dfd, const char __user *name, unsigned flags,
|
||||||
struct path *path, int *empty)
|
struct path *path, int *empty)
|
||||||
{
|
{
|
||||||
@ -2670,10 +2735,6 @@ static int may_open(struct path *path, int acc_mode, int flag)
|
|||||||
struct inode *inode = dentry->d_inode;
|
struct inode *inode = dentry->d_inode;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
/* O_PATH? */
|
|
||||||
if (!acc_mode)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (!inode)
|
if (!inode)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
@ -2695,7 +2756,7 @@ static int may_open(struct path *path, int acc_mode, int flag)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = inode_permission(inode, acc_mode);
|
error = inode_permission(inode, MAY_OPEN | acc_mode);
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
@ -2887,7 +2948,7 @@ static int atomic_open(struct nameidata *nd, struct dentry *dentry,
|
|||||||
if (*opened & FILE_CREATED) {
|
if (*opened & FILE_CREATED) {
|
||||||
WARN_ON(!(open_flag & O_CREAT));
|
WARN_ON(!(open_flag & O_CREAT));
|
||||||
fsnotify_create(dir, dentry);
|
fsnotify_create(dir, dentry);
|
||||||
acc_mode = MAY_OPEN;
|
acc_mode = 0;
|
||||||
}
|
}
|
||||||
error = may_open(&file->f_path, acc_mode, open_flag);
|
error = may_open(&file->f_path, acc_mode, open_flag);
|
||||||
if (error)
|
if (error)
|
||||||
@ -3100,7 +3161,7 @@ static int do_last(struct nameidata *nd,
|
|||||||
/* Don't check for write permission, don't truncate */
|
/* Don't check for write permission, don't truncate */
|
||||||
open_flag &= ~O_TRUNC;
|
open_flag &= ~O_TRUNC;
|
||||||
will_truncate = false;
|
will_truncate = false;
|
||||||
acc_mode = MAY_OPEN;
|
acc_mode = 0;
|
||||||
path_to_nameidata(&path, nd);
|
path_to_nameidata(&path, nd);
|
||||||
goto finish_open_created;
|
goto finish_open_created;
|
||||||
}
|
}
|
||||||
@ -3184,10 +3245,11 @@ static int do_last(struct nameidata *nd,
|
|||||||
got_write = true;
|
got_write = true;
|
||||||
}
|
}
|
||||||
finish_open_created:
|
finish_open_created:
|
||||||
error = may_open(&nd->path, acc_mode, open_flag);
|
if (likely(!(open_flag & O_PATH))) {
|
||||||
if (error)
|
error = may_open(&nd->path, acc_mode, open_flag);
|
||||||
goto out;
|
if (error)
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
BUG_ON(*opened & FILE_OPENED); /* once it's opened, it's opened */
|
BUG_ON(*opened & FILE_OPENED); /* once it's opened, it's opened */
|
||||||
error = vfs_open(&nd->path, file, current_cred());
|
error = vfs_open(&nd->path, file, current_cred());
|
||||||
if (!error) {
|
if (!error) {
|
||||||
@ -3274,7 +3336,7 @@ static int do_tmpfile(struct nameidata *nd, unsigned flags,
|
|||||||
goto out2;
|
goto out2;
|
||||||
audit_inode(nd->name, child, 0);
|
audit_inode(nd->name, child, 0);
|
||||||
/* Don't check for other permissions, the inode was just created */
|
/* Don't check for other permissions, the inode was just created */
|
||||||
error = may_open(&path, MAY_OPEN, op->open_flag);
|
error = may_open(&path, 0, op->open_flag);
|
||||||
if (error)
|
if (error)
|
||||||
goto out2;
|
goto out2;
|
||||||
file->f_path.mnt = path.mnt;
|
file->f_path.mnt = path.mnt;
|
||||||
|
@ -2609,18 +2609,18 @@ static long exact_copy_from_user(void *to, const void __user * from,
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
int copy_mount_options(const void __user * data, unsigned long *where)
|
void *copy_mount_options(const void __user * data)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
unsigned long page;
|
|
||||||
unsigned long size;
|
unsigned long size;
|
||||||
|
char *copy;
|
||||||
|
|
||||||
*where = 0;
|
|
||||||
if (!data)
|
if (!data)
|
||||||
return 0;
|
return NULL;
|
||||||
|
|
||||||
if (!(page = __get_free_page(GFP_KERNEL)))
|
copy = kmalloc(PAGE_SIZE, GFP_KERNEL);
|
||||||
return -ENOMEM;
|
if (!copy)
|
||||||
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
/* We only care that *some* data at the address the user
|
/* We only care that *some* data at the address the user
|
||||||
* gave us is valid. Just in case, we'll zero
|
* gave us is valid. Just in case, we'll zero
|
||||||
@ -2631,15 +2631,14 @@ int copy_mount_options(const void __user * data, unsigned long *where)
|
|||||||
if (size > PAGE_SIZE)
|
if (size > PAGE_SIZE)
|
||||||
size = PAGE_SIZE;
|
size = PAGE_SIZE;
|
||||||
|
|
||||||
i = size - exact_copy_from_user((void *)page, data, size);
|
i = size - exact_copy_from_user(copy, data, size);
|
||||||
if (!i) {
|
if (!i) {
|
||||||
free_page(page);
|
kfree(copy);
|
||||||
return -EFAULT;
|
return ERR_PTR(-EFAULT);
|
||||||
}
|
}
|
||||||
if (i != PAGE_SIZE)
|
if (i != PAGE_SIZE)
|
||||||
memset((char *)page + i, 0, PAGE_SIZE - i);
|
memset(copy + i, 0, PAGE_SIZE - i);
|
||||||
*where = page;
|
return copy;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *copy_mount_string(const void __user *data)
|
char *copy_mount_string(const void __user *data)
|
||||||
@ -2906,7 +2905,7 @@ SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name,
|
|||||||
int ret;
|
int ret;
|
||||||
char *kernel_type;
|
char *kernel_type;
|
||||||
char *kernel_dev;
|
char *kernel_dev;
|
||||||
unsigned long data_page;
|
void *options;
|
||||||
|
|
||||||
kernel_type = copy_mount_string(type);
|
kernel_type = copy_mount_string(type);
|
||||||
ret = PTR_ERR(kernel_type);
|
ret = PTR_ERR(kernel_type);
|
||||||
@ -2918,14 +2917,14 @@ SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name,
|
|||||||
if (IS_ERR(kernel_dev))
|
if (IS_ERR(kernel_dev))
|
||||||
goto out_dev;
|
goto out_dev;
|
||||||
|
|
||||||
ret = copy_mount_options(data, &data_page);
|
options = copy_mount_options(data);
|
||||||
if (ret < 0)
|
ret = PTR_ERR(options);
|
||||||
|
if (IS_ERR(options))
|
||||||
goto out_data;
|
goto out_data;
|
||||||
|
|
||||||
ret = do_mount(kernel_dev, dir_name, kernel_type, flags,
|
ret = do_mount(kernel_dev, dir_name, kernel_type, flags, options);
|
||||||
(void *) data_page);
|
|
||||||
|
|
||||||
free_page(data_page);
|
kfree(options);
|
||||||
out_data:
|
out_data:
|
||||||
kfree(kernel_dev);
|
kfree(kernel_dev);
|
||||||
out_dev:
|
out_dev:
|
||||||
@ -2949,9 +2948,9 @@ bool is_path_reachable(struct mount *mnt, struct dentry *dentry,
|
|||||||
return &mnt->mnt == root->mnt && is_subdir(dentry, root->dentry);
|
return &mnt->mnt == root->mnt && is_subdir(dentry, root->dentry);
|
||||||
}
|
}
|
||||||
|
|
||||||
int path_is_under(struct path *path1, struct path *path2)
|
bool path_is_under(struct path *path1, struct path *path2)
|
||||||
{
|
{
|
||||||
int res;
|
bool res;
|
||||||
read_seqlock_excl(&mount_lock);
|
read_seqlock_excl(&mount_lock);
|
||||||
res = is_path_reachable(real_mount(path1->mnt), path1->dentry, path2);
|
res = is_path_reachable(real_mount(path1->mnt), path1->dentry, path2);
|
||||||
read_sequnlock_excl(&mount_lock);
|
read_sequnlock_excl(&mount_lock);
|
||||||
|
@ -823,7 +823,7 @@ compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp,
|
|||||||
} else
|
} else
|
||||||
dchild = dget(dparent);
|
dchild = dget(dparent);
|
||||||
} else
|
} else
|
||||||
dchild = lookup_one_len(name, dparent, namlen);
|
dchild = lookup_one_len_unlocked(name, dparent, namlen);
|
||||||
if (IS_ERR(dchild))
|
if (IS_ERR(dchild))
|
||||||
return rv;
|
return rv;
|
||||||
if (d_mountpoint(dchild))
|
if (d_mountpoint(dchild))
|
||||||
|
@ -2858,14 +2858,14 @@ nfsd4_encode_dirent_fattr(struct xdr_stream *xdr, struct nfsd4_readdir *cd,
|
|||||||
__be32 nfserr;
|
__be32 nfserr;
|
||||||
int ignore_crossmnt = 0;
|
int ignore_crossmnt = 0;
|
||||||
|
|
||||||
dentry = lookup_one_len(name, cd->rd_fhp->fh_dentry, namlen);
|
dentry = lookup_one_len_unlocked(name, cd->rd_fhp->fh_dentry, namlen);
|
||||||
if (IS_ERR(dentry))
|
if (IS_ERR(dentry))
|
||||||
return nfserrno(PTR_ERR(dentry));
|
return nfserrno(PTR_ERR(dentry));
|
||||||
if (d_really_is_negative(dentry)) {
|
if (d_really_is_negative(dentry)) {
|
||||||
/*
|
/*
|
||||||
* nfsd_buffered_readdir drops the i_mutex between
|
* we're not holding the i_mutex here, so there's
|
||||||
* readdir and calling this callback, leaving a window
|
* a window where this directory entry could have gone
|
||||||
* where this directory entry could have gone away.
|
* away.
|
||||||
*/
|
*/
|
||||||
dput(dentry);
|
dput(dentry);
|
||||||
return nfserr_noent;
|
return nfserr_noent;
|
||||||
|
@ -218,10 +218,16 @@ nfsd_lookup_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp,
|
|||||||
host_err = PTR_ERR(dentry);
|
host_err = PTR_ERR(dentry);
|
||||||
if (IS_ERR(dentry))
|
if (IS_ERR(dentry))
|
||||||
goto out_nfserr;
|
goto out_nfserr;
|
||||||
/*
|
|
||||||
* check if we have crossed a mount point ...
|
|
||||||
*/
|
|
||||||
if (nfsd_mountpoint(dentry, exp)) {
|
if (nfsd_mountpoint(dentry, exp)) {
|
||||||
|
/*
|
||||||
|
* We don't need the i_mutex after all. It's
|
||||||
|
* still possible we could open this (regular
|
||||||
|
* files can be mountpoints too), but the
|
||||||
|
* i_mutex is just there to prevent renames of
|
||||||
|
* something that we might be about to delegate,
|
||||||
|
* and a mountpoint won't be renamed:
|
||||||
|
*/
|
||||||
|
fh_unlock(fhp);
|
||||||
if ((host_err = nfsd_cross_mnt(rqstp, &dentry, &exp))) {
|
if ((host_err = nfsd_cross_mnt(rqstp, &dentry, &exp))) {
|
||||||
dput(dentry);
|
dput(dentry);
|
||||||
goto out_nfserr;
|
goto out_nfserr;
|
||||||
@ -1817,7 +1823,6 @@ static __be32 nfsd_buffered_readdir(struct file *file, nfsd_filldir_t func,
|
|||||||
offset = *offsetp;
|
offset = *offsetp;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
struct inode *dir_inode = file_inode(file);
|
|
||||||
unsigned int reclen;
|
unsigned int reclen;
|
||||||
|
|
||||||
cdp->err = nfserr_eof; /* will be cleared on successful read */
|
cdp->err = nfserr_eof; /* will be cleared on successful read */
|
||||||
@ -1836,15 +1841,6 @@ static __be32 nfsd_buffered_readdir(struct file *file, nfsd_filldir_t func,
|
|||||||
if (!size)
|
if (!size)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
|
||||||
* Various filldir functions may end up calling back into
|
|
||||||
* lookup_one_len() and the file system's ->lookup() method.
|
|
||||||
* These expect i_mutex to be held, as it would within readdir.
|
|
||||||
*/
|
|
||||||
host_err = mutex_lock_killable(&dir_inode->i_mutex);
|
|
||||||
if (host_err)
|
|
||||||
break;
|
|
||||||
|
|
||||||
de = (struct buffered_dirent *)buf.dirent;
|
de = (struct buffered_dirent *)buf.dirent;
|
||||||
while (size > 0) {
|
while (size > 0) {
|
||||||
offset = de->offset;
|
offset = de->offset;
|
||||||
@ -1861,7 +1857,6 @@ static __be32 nfsd_buffered_readdir(struct file *file, nfsd_filldir_t func,
|
|||||||
size -= reclen;
|
size -= reclen;
|
||||||
de = (struct buffered_dirent *)((char *)de + reclen);
|
de = (struct buffered_dirent *)((char *)de + reclen);
|
||||||
}
|
}
|
||||||
mutex_unlock(&dir_inode->i_mutex);
|
|
||||||
if (size > 0) /* We bailed out early */
|
if (size > 0) /* We bailed out early */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1316,13 +1316,11 @@ nilfs_mount(struct file_system_type *fs_type, int flags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!s->s_root) {
|
if (!s->s_root) {
|
||||||
char b[BDEVNAME_SIZE];
|
s_new = true;
|
||||||
|
|
||||||
s_new = true;
|
|
||||||
|
|
||||||
/* New superblock instance created */
|
/* New superblock instance created */
|
||||||
s->s_mode = mode;
|
s->s_mode = mode;
|
||||||
strlcpy(s->s_id, bdevname(sd.bdev, b), sizeof(s->s_id));
|
snprintf(s->s_id, sizeof(s->s_id), "%pg", sd.bdev);
|
||||||
sb_set_blocksize(s, block_size(sd.bdev));
|
sb_set_blocksize(s, block_size(sd.bdev));
|
||||||
|
|
||||||
err = nilfs_fill_super(s, data, flags & MS_SILENT ? 1 : 0);
|
err = nilfs_fill_super(s, data, flags & MS_SILENT ? 1 : 0);
|
||||||
|
@ -887,7 +887,7 @@ EXPORT_SYMBOL(dentry_open);
|
|||||||
static inline int build_open_flags(int flags, umode_t mode, struct open_flags *op)
|
static inline int build_open_flags(int flags, umode_t mode, struct open_flags *op)
|
||||||
{
|
{
|
||||||
int lookup_flags = 0;
|
int lookup_flags = 0;
|
||||||
int acc_mode;
|
int acc_mode = ACC_MODE(flags);
|
||||||
|
|
||||||
if (flags & (O_CREAT | __O_TMPFILE))
|
if (flags & (O_CREAT | __O_TMPFILE))
|
||||||
op->mode = (mode & S_IALLUGO) | S_IFREG;
|
op->mode = (mode & S_IALLUGO) | S_IFREG;
|
||||||
@ -909,7 +909,6 @@ static inline int build_open_flags(int flags, umode_t mode, struct open_flags *o
|
|||||||
if (flags & __O_TMPFILE) {
|
if (flags & __O_TMPFILE) {
|
||||||
if ((flags & O_TMPFILE_MASK) != O_TMPFILE)
|
if ((flags & O_TMPFILE_MASK) != O_TMPFILE)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
acc_mode = MAY_OPEN | ACC_MODE(flags);
|
|
||||||
if (!(acc_mode & MAY_WRITE))
|
if (!(acc_mode & MAY_WRITE))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
} else if (flags & O_PATH) {
|
} else if (flags & O_PATH) {
|
||||||
@ -919,8 +918,6 @@ static inline int build_open_flags(int flags, umode_t mode, struct open_flags *o
|
|||||||
*/
|
*/
|
||||||
flags &= O_DIRECTORY | O_NOFOLLOW | O_PATH;
|
flags &= O_DIRECTORY | O_NOFOLLOW | O_PATH;
|
||||||
acc_mode = 0;
|
acc_mode = 0;
|
||||||
} else {
|
|
||||||
acc_mode = MAY_OPEN | ACC_MODE(flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
op->open_flag = flags;
|
op->open_flag = flags;
|
||||||
|
@ -2365,7 +2365,7 @@ static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf,
|
|||||||
size_t count, loff_t *ppos)
|
size_t count, loff_t *ppos)
|
||||||
{
|
{
|
||||||
struct inode * inode = file_inode(file);
|
struct inode * inode = file_inode(file);
|
||||||
char *page;
|
void *page;
|
||||||
ssize_t length;
|
ssize_t length;
|
||||||
struct task_struct *task = get_proc_task(inode);
|
struct task_struct *task = get_proc_task(inode);
|
||||||
|
|
||||||
@ -2380,14 +2380,11 @@ static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf,
|
|||||||
if (*ppos != 0)
|
if (*ppos != 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
length = -ENOMEM;
|
page = memdup_user(buf, count);
|
||||||
page = (char*)__get_free_page(GFP_TEMPORARY);
|
if (IS_ERR(page)) {
|
||||||
if (!page)
|
length = PTR_ERR(page);
|
||||||
goto out;
|
goto out;
|
||||||
|
}
|
||||||
length = -EFAULT;
|
|
||||||
if (copy_from_user(page, buf, count))
|
|
||||||
goto out_free;
|
|
||||||
|
|
||||||
/* Guard against adverse ptrace interaction */
|
/* Guard against adverse ptrace interaction */
|
||||||
length = mutex_lock_interruptible(&task->signal->cred_guard_mutex);
|
length = mutex_lock_interruptible(&task->signal->cred_guard_mutex);
|
||||||
@ -2396,10 +2393,10 @@ static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf,
|
|||||||
|
|
||||||
length = security_setprocattr(task,
|
length = security_setprocattr(task,
|
||||||
(char*)file->f_path.dentry->d_name.name,
|
(char*)file->f_path.dentry->d_name.name,
|
||||||
(void*)page, count);
|
page, count);
|
||||||
mutex_unlock(&task->signal->cred_guard_mutex);
|
mutex_unlock(&task->signal->cred_guard_mutex);
|
||||||
out_free:
|
out_free:
|
||||||
free_page((unsigned long) page);
|
kfree(page);
|
||||||
out:
|
out:
|
||||||
put_task_struct(task);
|
put_task_struct(task);
|
||||||
out_no_task:
|
out_no_task:
|
||||||
|
@ -258,6 +258,7 @@ static int proc_readfd_common(struct file *file, struct dir_context *ctx,
|
|||||||
name, len, instantiate, p,
|
name, len, instantiate, p,
|
||||||
(void *)(unsigned long)fd))
|
(void *)(unsigned long)fd))
|
||||||
goto out_fd_loop;
|
goto out_fd_loop;
|
||||||
|
cond_resched();
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
}
|
}
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
|
@ -95,9 +95,9 @@ static int show_vfsmnt(struct seq_file *m, struct vfsmount *mnt)
|
|||||||
{
|
{
|
||||||
struct proc_mounts *p = m->private;
|
struct proc_mounts *p = m->private;
|
||||||
struct mount *r = real_mount(mnt);
|
struct mount *r = real_mount(mnt);
|
||||||
int err = 0;
|
|
||||||
struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
|
struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
|
||||||
struct super_block *sb = mnt_path.dentry->d_sb;
|
struct super_block *sb = mnt_path.dentry->d_sb;
|
||||||
|
int err;
|
||||||
|
|
||||||
if (sb->s_op->show_devname) {
|
if (sb->s_op->show_devname) {
|
||||||
err = sb->s_op->show_devname(m, mnt_path.dentry);
|
err = sb->s_op->show_devname(m, mnt_path.dentry);
|
||||||
@ -131,16 +131,17 @@ static int show_mountinfo(struct seq_file *m, struct vfsmount *mnt)
|
|||||||
struct mount *r = real_mount(mnt);
|
struct mount *r = real_mount(mnt);
|
||||||
struct super_block *sb = mnt->mnt_sb;
|
struct super_block *sb = mnt->mnt_sb;
|
||||||
struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
|
struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
|
||||||
int err = 0;
|
int err;
|
||||||
|
|
||||||
seq_printf(m, "%i %i %u:%u ", r->mnt_id, r->mnt_parent->mnt_id,
|
seq_printf(m, "%i %i %u:%u ", r->mnt_id, r->mnt_parent->mnt_id,
|
||||||
MAJOR(sb->s_dev), MINOR(sb->s_dev));
|
MAJOR(sb->s_dev), MINOR(sb->s_dev));
|
||||||
if (sb->s_op->show_path)
|
if (sb->s_op->show_path) {
|
||||||
err = sb->s_op->show_path(m, mnt->mnt_root);
|
err = sb->s_op->show_path(m, mnt->mnt_root);
|
||||||
else
|
if (err)
|
||||||
|
goto out;
|
||||||
|
} else {
|
||||||
seq_dentry(m, mnt->mnt_root, " \t\n\\");
|
seq_dentry(m, mnt->mnt_root, " \t\n\\");
|
||||||
if (err)
|
}
|
||||||
goto out;
|
|
||||||
seq_putc(m, ' ');
|
seq_putc(m, ' ');
|
||||||
|
|
||||||
/* mountpoints outside of chroot jail will give SEQ_SKIP on this */
|
/* mountpoints outside of chroot jail will give SEQ_SKIP on this */
|
||||||
@ -168,12 +169,13 @@ static int show_mountinfo(struct seq_file *m, struct vfsmount *mnt)
|
|||||||
seq_puts(m, " - ");
|
seq_puts(m, " - ");
|
||||||
show_type(m, sb);
|
show_type(m, sb);
|
||||||
seq_putc(m, ' ');
|
seq_putc(m, ' ');
|
||||||
if (sb->s_op->show_devname)
|
if (sb->s_op->show_devname) {
|
||||||
err = sb->s_op->show_devname(m, mnt->mnt_root);
|
err = sb->s_op->show_devname(m, mnt->mnt_root);
|
||||||
else
|
if (err)
|
||||||
|
goto out;
|
||||||
|
} else {
|
||||||
mangle(m, r->mnt_devname ? r->mnt_devname : "none");
|
mangle(m, r->mnt_devname ? r->mnt_devname : "none");
|
||||||
if (err)
|
}
|
||||||
goto out;
|
|
||||||
seq_puts(m, sb->s_flags & MS_RDONLY ? " ro" : " rw");
|
seq_puts(m, sb->s_flags & MS_RDONLY ? " ro" : " rw");
|
||||||
err = show_sb_opts(m, sb);
|
err = show_sb_opts(m, sb);
|
||||||
if (err)
|
if (err)
|
||||||
@ -191,7 +193,7 @@ static int show_vfsstat(struct seq_file *m, struct vfsmount *mnt)
|
|||||||
struct mount *r = real_mount(mnt);
|
struct mount *r = real_mount(mnt);
|
||||||
struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
|
struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
|
||||||
struct super_block *sb = mnt_path.dentry->d_sb;
|
struct super_block *sb = mnt_path.dentry->d_sb;
|
||||||
int err = 0;
|
int err;
|
||||||
|
|
||||||
/* device */
|
/* device */
|
||||||
if (sb->s_op->show_devname) {
|
if (sb->s_op->show_devname) {
|
||||||
@ -220,8 +222,7 @@ static int show_vfsstat(struct seq_file *m, struct vfsmount *mnt)
|
|||||||
/* optional statistics */
|
/* optional statistics */
|
||||||
if (sb->s_op->show_stats) {
|
if (sb->s_op->show_stats) {
|
||||||
seq_putc(m, ' ');
|
seq_putc(m, ' ');
|
||||||
if (!err)
|
err = sb->s_op->show_stats(m, mnt_path.dentry);
|
||||||
err = sb->s_op->show_stats(m, mnt_path.dentry);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
seq_putc(m, '\n');
|
seq_putc(m, '\n');
|
||||||
|
@ -171,6 +171,45 @@ loff_t fixed_size_llseek(struct file *file, loff_t offset, int whence, loff_t si
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(fixed_size_llseek);
|
EXPORT_SYMBOL(fixed_size_llseek);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* no_seek_end_llseek - llseek implementation for fixed-sized devices
|
||||||
|
* @file: file structure to seek on
|
||||||
|
* @offset: file offset to seek to
|
||||||
|
* @whence: type of seek
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
loff_t no_seek_end_llseek(struct file *file, loff_t offset, int whence)
|
||||||
|
{
|
||||||
|
switch (whence) {
|
||||||
|
case SEEK_SET: case SEEK_CUR:
|
||||||
|
return generic_file_llseek_size(file, offset, whence,
|
||||||
|
~0ULL, 0);
|
||||||
|
default:
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(no_seek_end_llseek);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* no_seek_end_llseek_size - llseek implementation for fixed-sized devices
|
||||||
|
* @file: file structure to seek on
|
||||||
|
* @offset: file offset to seek to
|
||||||
|
* @whence: type of seek
|
||||||
|
* @size: maximal offset allowed
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
loff_t no_seek_end_llseek_size(struct file *file, loff_t offset, int whence, loff_t size)
|
||||||
|
{
|
||||||
|
switch (whence) {
|
||||||
|
case SEEK_SET: case SEEK_CUR:
|
||||||
|
return generic_file_llseek_size(file, offset, whence,
|
||||||
|
size, 0);
|
||||||
|
default:
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(no_seek_end_llseek_size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* noop_llseek - No Operation Performed llseek implementation
|
* noop_llseek - No Operation Performed llseek implementation
|
||||||
* @file: file structure to seek on
|
* @file: file structure to seek on
|
||||||
|
@ -618,12 +618,10 @@ static void release_buffer_page(struct buffer_head *bh)
|
|||||||
|
|
||||||
static void reiserfs_end_buffer_io_sync(struct buffer_head *bh, int uptodate)
|
static void reiserfs_end_buffer_io_sync(struct buffer_head *bh, int uptodate)
|
||||||
{
|
{
|
||||||
char b[BDEVNAME_SIZE];
|
|
||||||
|
|
||||||
if (buffer_journaled(bh)) {
|
if (buffer_journaled(bh)) {
|
||||||
reiserfs_warning(NULL, "clm-2084",
|
reiserfs_warning(NULL, "clm-2084",
|
||||||
"pinned buffer %lu:%s sent to disk",
|
"pinned buffer %lu:%pg sent to disk",
|
||||||
bh->b_blocknr, bdevname(bh->b_bdev, b));
|
bh->b_blocknr, bh->b_bdev);
|
||||||
}
|
}
|
||||||
if (uptodate)
|
if (uptodate)
|
||||||
set_buffer_uptodate(bh);
|
set_buffer_uptodate(bh);
|
||||||
@ -2387,11 +2385,10 @@ static int journal_read(struct super_block *sb)
|
|||||||
int replay_count = 0;
|
int replay_count = 0;
|
||||||
int continue_replay = 1;
|
int continue_replay = 1;
|
||||||
int ret;
|
int ret;
|
||||||
char b[BDEVNAME_SIZE];
|
|
||||||
|
|
||||||
cur_dblock = SB_ONDISK_JOURNAL_1st_BLOCK(sb);
|
cur_dblock = SB_ONDISK_JOURNAL_1st_BLOCK(sb);
|
||||||
reiserfs_info(sb, "checking transaction log (%s)\n",
|
reiserfs_info(sb, "checking transaction log (%pg)\n",
|
||||||
bdevname(journal->j_dev_bd, b));
|
journal->j_dev_bd);
|
||||||
start = get_seconds();
|
start = get_seconds();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2651,8 +2648,8 @@ static int journal_init_dev(struct super_block *super,
|
|||||||
|
|
||||||
set_blocksize(journal->j_dev_bd, super->s_blocksize);
|
set_blocksize(journal->j_dev_bd, super->s_blocksize);
|
||||||
reiserfs_info(super,
|
reiserfs_info(super,
|
||||||
"journal_init_dev: journal device: %s\n",
|
"journal_init_dev: journal device: %pg\n",
|
||||||
bdevname(journal->j_dev_bd, b));
|
journal->j_dev_bd);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2724,7 +2721,6 @@ int journal_init(struct super_block *sb, const char *j_dev_name,
|
|||||||
struct reiserfs_journal_header *jh;
|
struct reiserfs_journal_header *jh;
|
||||||
struct reiserfs_journal *journal;
|
struct reiserfs_journal *journal;
|
||||||
struct reiserfs_journal_list *jl;
|
struct reiserfs_journal_list *jl;
|
||||||
char b[BDEVNAME_SIZE];
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
journal = SB_JOURNAL(sb) = vzalloc(sizeof(struct reiserfs_journal));
|
journal = SB_JOURNAL(sb) = vzalloc(sizeof(struct reiserfs_journal));
|
||||||
@ -2794,10 +2790,10 @@ int journal_init(struct super_block *sb, const char *j_dev_name,
|
|||||||
&& (le32_to_cpu(jh->jh_journal.jp_journal_magic) !=
|
&& (le32_to_cpu(jh->jh_journal.jp_journal_magic) !=
|
||||||
sb_jp_journal_magic(rs))) {
|
sb_jp_journal_magic(rs))) {
|
||||||
reiserfs_warning(sb, "sh-460",
|
reiserfs_warning(sb, "sh-460",
|
||||||
"journal header magic %x (device %s) does "
|
"journal header magic %x (device %pg) does "
|
||||||
"not match to magic found in super block %x",
|
"not match to magic found in super block %x",
|
||||||
jh->jh_journal.jp_journal_magic,
|
jh->jh_journal.jp_journal_magic,
|
||||||
bdevname(journal->j_dev_bd, b),
|
journal->j_dev_bd,
|
||||||
sb_jp_journal_magic(rs));
|
sb_jp_journal_magic(rs));
|
||||||
brelse(bhjh);
|
brelse(bhjh);
|
||||||
goto free_and_return;
|
goto free_and_return;
|
||||||
@ -2818,10 +2814,10 @@ int journal_init(struct super_block *sb, const char *j_dev_name,
|
|||||||
journal->j_max_trans_age = commit_max_age;
|
journal->j_max_trans_age = commit_max_age;
|
||||||
}
|
}
|
||||||
|
|
||||||
reiserfs_info(sb, "journal params: device %s, size %u, "
|
reiserfs_info(sb, "journal params: device %pg, size %u, "
|
||||||
"journal first block %u, max trans len %u, max batch %u, "
|
"journal first block %u, max trans len %u, max batch %u, "
|
||||||
"max commit age %u, max trans age %u\n",
|
"max commit age %u, max trans age %u\n",
|
||||||
bdevname(journal->j_dev_bd, b),
|
journal->j_dev_bd,
|
||||||
SB_ONDISK_JOURNAL_SIZE(sb),
|
SB_ONDISK_JOURNAL_SIZE(sb),
|
||||||
SB_ONDISK_JOURNAL_1st_BLOCK(sb),
|
SB_ONDISK_JOURNAL_1st_BLOCK(sb),
|
||||||
journal->j_trans_max,
|
journal->j_trans_max,
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user