]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
Merge branches 'futexes-for-linus', 'irq-core-for-linus' and 'bkl-drivers-for-linus...
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 1 Mar 2010 16:51:52 +0000 (08:51 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 1 Mar 2010 16:51:52 +0000 (08:51 -0800)
* 'futexes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  futex: Protect pid lookup in compat code with RCU

* 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  genirq: Fix documentation of default chip disable()

* 'bkl-drivers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  nvram: Drop the BKL from nvram_open()

1  2  3  4 
drivers/char/nvram.c

diff --combined drivers/char/nvram.c
index fdbcc9fd6d3143a00810fd664d77379ee083717b,88cee4099be940c294127d0a172996d90c597912,fdbcc9fd6d3143a00810fd664d77379ee083717b,7cf4518c030f2b3a9293c23dd599643739758d1c..5eb83c3ca20de35be340031015a93495ae19e12b
    #define NVRAM_VERSION       "1.3"
    
    #include <linux/module.h>
 -  #include <linux/smp_lock.h>
    #include <linux/nvram.h>
    
    #define PC          1
    #include <linux/spinlock.h>
    #include <linux/io.h>
    #include <linux/uaccess.h>
 + +#include <linux/smp_lock.h>
    
    #include <asm/system.h>
    
@@@@@ -214,6 -214,7 -214,6 -213,6 +214,6 @@@@@ void nvram_set_checksum(void
    
    static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
    {
 -      lock_kernel();
        switch (origin) {
        case 0:
                /* nothing to do */
                offset += NVRAM_BYTES;
                break;
        }
 -      unlock_kernel();
 +  
        return (offset >= 0) ? (file->f_pos = offset) : -EINVAL;
    }
    
@@@@@ -264,16 -265,10 -264,16 -263,10 +264,16 @@@@@ static ssize_t nvram_write(struct file 
        unsigned char contents[NVRAM_BYTES];
        unsigned i = *ppos;
        unsigned char *tmp;
 - -    int len;
    
 - -    len = (NVRAM_BYTES - i) < count ? (NVRAM_BYTES - i) : count;
 - -    if (copy_from_user(contents, buf, len))
 + +    if (i >= NVRAM_BYTES)
 + +            return 0;       /* Past EOF */
 + +
 + +    if (count > NVRAM_BYTES - i)
 + +            count = NVRAM_BYTES - i;
 + +    if (count > NVRAM_BYTES)
 + +            return -EFAULT; /* Can't happen, but prove it to gcc */
 + +
 + +    if (copy_from_user(contents, buf, count))
                return -EFAULT;
    
        spin_lock_irq(&rtc_lock);
        if (!__nvram_check_checksum())
                goto checksum_err;
    
 - -    for (tmp = contents; count-- > 0 && i < NVRAM_BYTES; ++i, ++tmp)
 + +    for (tmp = contents; count--; ++i, ++tmp)
                __nvram_write_byte(*tmp, i);
    
        __nvram_set_checksum();
@@@@@ -336,14 -331,14 -336,14 -329,12 +336,12 @@@@@ static int nvram_ioctl(struct inode *in
    
    static int nvram_open(struct inode *inode, struct file *file)
    {
---     lock_kernel();
        spin_lock(&nvram_state_lock);
    
        if ((nvram_open_cnt && (file->f_flags & O_EXCL)) ||
            (nvram_open_mode & NVRAM_EXCL) ||
            ((file->f_mode & FMODE_WRITE) && (nvram_open_mode & NVRAM_WRITE))) {
                spin_unlock(&nvram_state_lock);
---             unlock_kernel();
                return -EBUSY;
        }
    
        nvram_open_cnt++;
    
        spin_unlock(&nvram_state_lock);
---     unlock_kernel();
    
        return 0;
    }