1. 20 Feb, 2015 1 commit
    • David Howells's avatar
      Infiniband: Fix potential NULL d_inode dereference · a95104fd
      David Howells authored
      
      
      Code that does this:
      
      	if (!(d_unhashed(tmp) && tmp->d_inode)) {
      		...
      		simple_unlink(parent->d_inode, tmp);
      	}
      
      is broken because:
      
      	!(d_unhashed(tmp) && tmp->d_inode)
      
      is equivalent to:
      
      	!d_unhashed(tmp) || !tmp->d_inode
      
      so it is possible to get into simple_unlink() with tmp->d_inode == NULL.
      
      simple_unlink(), however, assumes tmp->d_inode cannot be NULL.
      
      I think that what was meant is this:
      
      	!d_unhashed(tmp) && tmp->d_inode
      
      and that the logical-not operator or the final close-bracket was misplaced.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Bryan O'Sullivan <bos@pathscale.com>
      cc: Roland Dreier <rolandd@cisco.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      a95104fd
  2. 09 Oct, 2014 1 commit
  3. 17 Mar, 2014 1 commit
  4. 13 Nov, 2013 1 commit
    • Al Viro's avatar
      qib_fs: fix (some) dcache abuses · 441a9d0e
      Al Viro authored
      
      
      * lookup_one_len() really wants i_mutex held on directory.
      * leaks galore - just mount ipathfs, then
      cd /sys/bus/pci/drivers/qib_ib; echo *:*:*.* >unbind
      on a box with that card present and try to umount ipathfs...
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      441a9d0e
  5. 04 Mar, 2013 1 commit
    • Eric W. Biederman's avatar
      fs: Limit sys_mount to only request filesystem modules. · 7f78e035
      Eric W. Biederman authored
      
      
      Modify the request_module to prefix the file system type with "fs-"
      and add aliases to all of the filesystems that can be built as modules
      to match.
      
      A common practice is to build all of the kernel code and leave code
      that is not commonly needed as modules, with the result that many
      users are exposed to any bug anywhere in the kernel.
      
      Looking for filesystems with a fs- prefix limits the pool of possible
      modules that can be loaded by mount to just filesystems trivially
      making things safer with no real cost.
      
      Using aliases means user space can control the policy of which
      filesystem modules are auto-loaded by editing /etc/modprobe.d/*.conf
      with blacklist and alias directives.  Allowing simple, safe,
      well understood work-arounds to known problematic software.
      
      This also addresses a rare but unfortunate problem where the filesystem
      name is not the same as it's module name and module auto-loading
      would not work.  While writing this patch I saw a handful of such
      cases.  The most significant being autofs that lives in the module
      autofs4.
      
      This is relevant to user namespaces because we can reach the request
      module in get_fs_type() without having any special permissions, and
      people get uncomfortable when a user specified string (in this case
      the filesystem type) goes all of the way to request_module.
      
      After having looked at this issue I don't think there is any
      particular reason to perform any filtering or permission checks beyond
      making it clear in the module request that we want a filesystem
      module.  The common pattern in the kernel is to call request_module()
      without regards to the users permissions.  In general all a filesystem
      module does once loaded is call register_filesystem() and go to sleep.
      Which means there is not much attack surface exposed by loading a
      filesytem module unless the filesystem is mounted.  In a user
      namespace filesystems are not mounted unless .fs_flags = FS_USERNS_MOUNT,
      which most filesystems do not set today.
      Acked-by: default avatarSerge Hallyn <serge.hallyn@canonical.com>
      Acked-by: default avatarKees Cook <keescook@chromium.org>
      Reported-by: default avatarKees Cook <keescook@google.com>
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      7f78e035
  6. 23 Feb, 2013 1 commit
  7. 21 Sep, 2012 1 commit
  8. 19 Jul, 2012 1 commit
  9. 04 Jan, 2012 1 commit
  10. 07 Jan, 2011 3 commits
  11. 29 Oct, 2010 1 commit
  12. 26 Oct, 2010 1 commit
    • Christoph Hellwig's avatar
      fs: do not assign default i_ino in new_inode · 85fe4025
      Christoph Hellwig authored
      
      
      Instead of always assigning an increasing inode number in new_inode
      move the call to assign it into those callers that actually need it.
      For now callers that need it is estimated conservatively, that is
      the call is added to all filesystems that do not assign an i_ino
      by themselves.  For a few more filesystems we can avoid assigning
      any inode number given that they aren't user visible, and for others
      it could be done lazily when an inode number is actually needed,
      but that's left for later patches.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      85fe4025
  13. 15 Oct, 2010 1 commit
    • Arnd Bergmann's avatar
      llseek: automatically add .llseek fop · 6038f373
      Arnd Bergmann authored
      All file_operations should get a .llseek operation so we can make
      nonseekable_open the default for future file operations without a
      .llseek pointer.
      
      The three cases that we can automatically detect are no_llseek, seq_lseek
      and default_llseek. For cases where we can we can automatically prove that
      the file offset is always ignored, we use noop_llseek, which maintains
      the current behavior of not returning an error from a seek.
      
      New drivers should normally not use noop_llseek but instead use no_llseek
      and call nonseekable_open at open time.  Existing drivers can be converted
      to do the same when the maintainer knows for certain that no user code
      relies on calling seek on the device file.
      
      The generated code is often incorrectly indented and right now contains
      comments that clarify for each added line why a specific variant was
      chosen. In the version that gets submitted upstream, the comments will
      be gone and I will manually fix the indentation, because there does not
      see...
      6038f373
  14. 21 Jul, 2010 1 commit
  15. 04 Jun, 2010 1 commit
    • Al Viro's avatar
      fix the deadlock in qib_fs · 971b2e8a
      Al Viro authored
      
      
      get_sb_single() calls fill_super with superblock locked; calling
      deactivate_super() will deadlock immedately.  Moreover, if fill_super
      callback returns an error, get_sb_single() will release the reference
      to superblock itself just fine.
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      971b2e8a
  16. 26 May, 2010 1 commit
    • Roland Dreier's avatar
      IB/qib: Don't rely on (undefined) order of function parameter evaluation · f27ec1d6
      Roland Dreier authored
      
      
      Some of the qib sysfs code passes a buffer pointer into 
      simple_read_from_buffer() but relies on a function call in another 
      parameter of the same call to initialize that pointer.  Since the order
      of evaluation of function parameters is undefined, this will break if
      gcc chooses the wrong order.
      
      Fix this by splitting the code into two separate function calls.
      
      This was noticed because of warnings like the following on ppc:
      
          drivers/infiniband/hw/qib/qib_fs.c: In function 'portcntrs_2_read':
          drivers/infiniband/hw/qib/qib_fs.c:203: warning: 'counters' is used uninitialized in this function
      Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
      f27ec1d6
  17. 24 May, 2010 1 commit