1. 18 1月, 2011 27 次提交
  2. 17 1月, 2011 13 次提交
    • A
      mtd: mtdpart: disallow reading OOB past the end of the partition · 154bf89f
      Artem Bityutskiy 提交于
      This patch fixes the mtdpart bug which allows users reading OOB past the
      end of the partition. This happens because 'part_read_oob()' allows reading
      multiple OOB areas in one go, and mtdparts does not validate the OOB
      length in the request.
      
      Although there is such check in 'nand_do_read_oob()' in nand_base.c, but
      it checks that we do not read past the flash chip, not the partition,
      because in nand_base.c we work with the whole chip (e.g., mtd->size
      in nand_base.c is the size of the whole chip). So this check cannot
      be done correctly in nand_base.c and should be instead done in mtdparts.c.
      
      This problem was reported by Jason Liu <r64343@freescale.com> and reproduced
      with nandsim:
      
      $ modprobe nandsim first_id_byte=0x20 second_id_byte=0xaa third_id_byte=0x00 \
                         fourth_id_byte=0x15 parts=0x400,0x400
      $ modprobe nandsim mtd_oobtest.ko dev=0
      $ dmesg
      = snip =
      mtd_oobtest: attempting to read past end of device
      mtd_oobtest: an error is expected...
      mtd_oobtest: error: read past end of device
      = snip =
      mtd_oobtest: finished with 2 errors
      Reported-by: NJason Liu <liu.h.jason@gmail.com>
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      Signed-off-by: NDavid Woodhouse <David.Woodhouse@intel.com>
      154bf89f
    • N
      fs: fix address space warnings in ioctl_fiemap() · ecf5632d
      Namhyung Kim 提交于
      The fi_extents_start field of struct fiemap_extent_info is a
      user pointer but was not marked as __user. This makes sparse
      emit following warnings:
      
        CHECK   fs/ioctl.c
      fs/ioctl.c:114:26: warning: incorrect type in argument 1 (different address spaces)
      fs/ioctl.c:114:26:    expected void [noderef] <asn:1>*dst
      fs/ioctl.c:114:26:    got struct fiemap_extent *[assigned] dest
      fs/ioctl.c:202:14: warning: incorrect type in argument 1 (different address spaces)
      fs/ioctl.c:202:14:    expected void const volatile [noderef] <asn:1>*<noident>
      fs/ioctl.c:202:14:    got struct fiemap_extent *[assigned] fi_extents_start
      fs/ioctl.c:212:27: warning: incorrect type in argument 1 (different address spaces)
      fs/ioctl.c:212:27:    expected void [noderef] <asn:1>*dst
      fs/ioctl.c:212:27:    got char *<noident>
      
      Also add 'ufiemap' variable to eliminate unnecessary casts.
      Signed-off-by: NNamhyung Kim <namhyung@gmail.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      ecf5632d
    • N
      aio: check return value of create_workqueue() · 27eaa1c9
      Namhyung Kim 提交于
      Signed-off-by: NNamhyung Kim <namhyung@gmail.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      27eaa1c9
    • D
      hpfs_setattr error case avoids unlock_kernel · 274052ef
      Dr. David Alan Gilbert 提交于
      This fixed a case that 'sparse' spotted where hpfs_setattr has an error return
      that didn't go through it's path that unlocks.
      
      This is against git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
      version 6313e3c2.
      
      Build tested only, I don't have an hpfs file system to test.
      
      Dave
      Signed-off-by: NDr. David Alan Gilbert <linux@treblig.org>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      274052ef
    • N
      compat: copy missing fields in compat_statfs64 to user · e0bb6bda
      Namhyung Kim 提交于
      f_flags and f_spare fields were not copied to userspace when
      compat_sys_[f]statfs64 called.
      Signed-off-by: NNamhyung Kim <namhyung@gmail.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      e0bb6bda
    • N
      compat: update comment of compat statfs syscalls · 974d879e
      Namhyung Kim 提交于
      The commit 7ed1ee61 ("Take statfs variants to fs/statfs.c")
      separates out statfs syscalls from fs/open.c. Thus the comment
      should be changed also.
      Signed-off-by: NNamhyung Kim <namhyung@gmail.com>
      Cc: Jiri Kosina <trivial@kernel.org>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      974d879e
    • N
      compat: remove unnecessary assignment in compat_rw_copy_check_uvector() · 6a5640f1
      Namhyung Kim 提交于
      *@ret_pointer is initialized to @fast_pointer thus the assignment is
      redundant.
      Signed-off-by: NNamhyung Kim <namhyung@gmail.com>
      Cc: Jeff Moyer <jmoyer@redhat.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      6a5640f1
    • R
      fs: FS_POSIX_ACL does not depend on BLOCK · 16ebe911
      Randy Dunlap 提交于
      - Fix a kconfig unmet dependency warning.
      - Remove the comment that identifies which filesystems use POSIX ACL
        utility routines.
      - Move the FS_POSIX_ACL symbol outside of the BLOCK symbol if/endif block
        because its functions do not depend on BLOCK and some of the filesystems
        that use it do not depend on BLOCK.
      
      warning: (GENERIC_ACL && JFFS2_FS_POSIX_ACL && NFSD_V4 && NFS_ACL_SUPPORT && 9P_FS_POSIX_ACL) selects FS_POSIX_ACL which has unmet direct dependencies (BLOCK)
      Signed-off-by: NRandy Dunlap <randy.dunlap@oracle.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      16ebe911
    • S
      fs: Remove unlikely() from fget_light() · 3bc0ba43
      Steven Rostedt 提交于
      There's an unlikely() in fget_light() that assumes the file ref count
      will be 1. Running the annotate branch profiler on a desktop that is
      performing daily tasks (running firefox, evolution, xchat and is also part
      of a distcc farm), it shows that the ref count is not 1 that often.
      
       correct incorrect      %    Function                  File              Line
       ------- ---------      -    --------                  ----              ----
      1035099358 6209599193  85    fget_light              file_table.c         315
      
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      3bc0ba43
    • S
      fs: Remove unlikely() from fput_light() · c2b3e74b
      Steven Rostedt 提交于
      In fput_light(), there's an unlikely(fput_needed), which running on
      my normal desktop doing firefox, xchat, evolution and part of my distcc farm,
      and running the annotate branch profiler shows that the unlikely is not
      very unlikely.
      
       correct incorrect  %        Function             File              Line
       ------- ---------  -        --------             ----              ----
             0       48 100 fput_light                file.h               26
      115828710 897415279  88 fput_light              file.h               26
      865271179 5286128445  85 fput_light             file.h               26
      19568539  8923664  31 fput_light                file.h               26
      12353677  3562279  22 fput_light                file.h               26
        267691    67062  20 fput_light                file.h               26
      15014853   348172   2 fput_light                file.h               26
        209258      205   0 fput_light                file.h               26
       1364164        0   0 fput_light                file.h               26
      
      Which gives 1032903812 times it was correct and 6203351846 times it was
      incorrect, or 85% incorrect.
      
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      c2b3e74b
    • C
      fallocate should be a file operation · 2fe17c10
      Christoph Hellwig 提交于
      Currently all filesystems except XFS implement fallocate asynchronously,
      while XFS forced a commit.  Both of these are suboptimal - in case of O_SYNC
      I/O we really want our allocation on disk, especially for the !KEEP_SIZE
      case where we actually grow the file with user-visible zeroes.  On the
      other hand always commiting the transaction is a bad idea for fast-path
      uses of fallocate like for example in recent Samba versions.   Given
      that block allocation is a data plane operation anyway change it from
      an inode operation to a file operation so that we have the file structure
      available that lets us check for O_SYNC.
      
      This also includes moving the code around for a few of the filesystems,
      and remove the already unnedded S_ISDIR checks given that we only wire
      up fallocate for regular files.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      2fe17c10
    • C
      make the feature checks in ->fallocate future proof · 64c23e86
      Christoph Hellwig 提交于
      Instead of various home grown checks that might need updates for new
      flags just check for any bit outside the mask of the features supported
      by the filesystem.  This makes the check future proof for any newly
      added flag.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      64c23e86
    • Y
      staging: smbfs building fix · eb745dbc
      Yang Ruirui 提交于
      Building error for smbfs:
      
      drivers/staging/smbfs/dir.c:286: error: static declaration of 'smbfs_dentry_operations' follows non-static declaration
      drivers/staging/smbfs/proto.h:42: error: previous declaration of 'smbfs_dentry_operations' was here
      drivers/staging/smbfs/dir.c:294: error: static declaration of 'smbfs_dentry_operations_case' follows non-static declaration
      drivers/staging/smbfs/proto.h:41: error: previous declaration of 'smbfs_dentry_operations_case' was here
      make[3]: *** [drivers/staging/smbfs/dir.o] Error 1
      make[2]: *** [drivers/staging/smbfs] Error 2
      make[1]: *** [drivers/staging] Error 2
      make[1]: *** Waiting for unfinished jobs....
      
      Fix it by removing static keywords
      Signed-off-by: NYang Ruirui <ruirui.r.yang@tieto.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      eb745dbc