1. 21 5月, 2015 1 次提交
  2. 19 5月, 2015 2 次提交
  3. 11 8月, 2014 4 次提交
  4. 07 6月, 2014 1 次提交
    • B
      IB/umad: Fix use-after-free on close · 60e1751c
      Bart Van Assche 提交于
      Avoid that closing /dev/infiniband/umad<n> or /dev/infiniband/issm<n>
      triggers a use-after-free.  __fput() invokes f_op->release() before it
      invokes cdev_put().  Make sure that the ib_umad_device structure is
      freed by the cdev_put() call instead of f_op->release().  This avoids
      that changing the port mode from IB into Ethernet and back to IB
      followed by restarting opensmd triggers the following kernel oops:
      
          general protection fault: 0000 [#1] PREEMPT SMP
          RIP: 0010:[<ffffffff810cc65c>]  [<ffffffff810cc65c>] module_put+0x2c/0x170
          Call Trace:
           [<ffffffff81190f20>] cdev_put+0x20/0x30
           [<ffffffff8118e2ce>] __fput+0x1ae/0x1f0
           [<ffffffff8118e35e>] ____fput+0xe/0x10
           [<ffffffff810723bc>] task_work_run+0xac/0xe0
           [<ffffffff81002a9f>] do_notify_resume+0x9f/0xc0
           [<ffffffff814b8398>] int_signal+0x12/0x17
      
      Reference: https://bugzilla.kernel.org/show_bug.cgi?id=75051Signed-off-by: NBart Van Assche <bvanassche@acm.org>
      Reviewed-by: NYann Droneaud <ydroneaud@opteya.com>
      Cc: <stable@vger.kernel.org> # 3.x: 8ec0a0e6: IB/umad: Fix error handling
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      60e1751c
  5. 30 5月, 2014 1 次提交
    • B
      IB/umad: Fix error handling · 8ec0a0e6
      Bart Van Assche 提交于
      Avoid leaking a kref count in ib_umad_open() if port->ib_dev == NULL
      or if nonseekable_open() fails.
      
      Avoid leaking a kref count, that sm_sem is kept down and also that the
      IB_PORT_SM capability mask is not cleared in ib_umad_sm_open() if
      nonseekable_open() fails.
      
      Since container_of() never returns NULL, remove the code that tests
      whether container_of() returns NULL.
      
      Moving the kref_get() call from the start of ib_umad_*open() to the
      end is safe since it is the responsibility of the caller of these
      functions to ensure that the cdev pointer remains valid until at least
      when these functions return.
      Signed-off-by: NBart Van Assche <bvanassche@acm.org>
      Cc: <stable@vger.kernel.org>
      
      [ydroneaud@opteya.com: rework a bit to reduce the amount of code changed]
      Signed-off-by: NYann Droneaud <ydroneaud@opteya.com>
      
      [ nonseekable_open() can't actually fail, but....  - Roland ]
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      8ec0a0e6
  6. 04 1月, 2012 1 次提交
  7. 07 10月, 2011 1 次提交
  8. 24 5月, 2011 1 次提交
  9. 29 9月, 2010 1 次提交
  10. 15 7月, 2010 1 次提交
  11. 22 4月, 2010 1 次提交
    • R
      IB: Explicitly rule out llseek to avoid BKL in default_llseek() · bc1db9af
      Roland Dreier 提交于
      Several RDMA user-access drivers have file_operations structures with
      no .llseek method set.  None of the drivers actually do anything with
      f_pos, so this means llseek is essentially a NOP, instead of returning
      an error as leaving other file_operations methods unimplemented would
      do.  This is mostly harmless, except that a NULL .llseek means that
      default_llseek() is used, and this function grabs the BKL, which we
      would like to avoid.
      
      Since llseek does nothing useful on these files, we would like it to
      return an error to userspace instead of silently grabbing the BKL and
      succeeding.  For nearly all of the file types, we take the
      belt-and-suspenders approach of setting the .llseek method to
      no_llseek and also calling nonseekable_open(); the exception is the
      uverbs_event files, which are created with anon_inode_getfile(), which
      already sets f_mode the same way as nonseekable_open() would.
      
      This work is motivated by Arnd Bergmann's bkl-removal tree.
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      bc1db9af
  12. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  13. 08 3月, 2010 2 次提交
  14. 25 2月, 2010 6 次提交
  15. 05 10月, 2009 1 次提交
  16. 17 10月, 2008 1 次提交
  17. 15 7月, 2008 1 次提交
  18. 12 7月, 2008 1 次提交
  19. 21 6月, 2008 1 次提交
  20. 21 5月, 2008 1 次提交
    • G
      IB: fix race in device_create · 6c06aec2
      Greg Kroah-Hartman 提交于
      There is a race from when a device is created with device_create() and
      then the drvdata is set with a call to dev_set_drvdata() in which a
      sysfs file could be open, yet the drvdata will be NULL, causing all
      sorts of bad things to happen.
      
      This patch fixes the problem by using the new function,
      device_create_drvdata().
      
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Reviewed-by: NRoland Dreier <rolandd@cisco.com>
      Cc: Sean Hefty <sean.hefty@intel.com>
      Cc: Hal Rosenstock <hal.rosenstock@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      6c06aec2
  21. 20 4月, 2008 1 次提交
  22. 19 4月, 2008 1 次提交
  23. 26 1月, 2008 1 次提交
    • R
      IB/umad: Simplify and fix locking · 2fe7e6f7
      Roland Dreier 提交于
      In addition to being overly complex, the locking in user_mad.c is
      broken: there were multiple reports of deadlocks and lockdep warnings.
      In particular it seems that a single thread may end up trying to take
      the same rwsem for reading more than once, which is explicitly
      forbidden in the comments in <linux/rwsem.h>.
      
      To solve this, we change the locking to use plain mutexes instead of
      rwsems.  There is one mutex per open file, which protects the contents
      of the struct ib_umad_file, including the array of agents and list of
      queued packets; and there is one mutex per struct ib_umad_port, which
      protects the contents, including the list of open files.  We never
      hold the file mutex across calls to functions like ib_unregister_mad_agent(),
      which can call back into other ib_umad code to queue a packet, and we
      always hold the port mutex as long as we need to make sure that a
      device is not hot-unplugged from under us.
      
      This even makes things nicer for users of the -rt patch, since we
      remove calls to downgrade_write() (which is not implemented in -rt).
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      2fe7e6f7
  24. 10 10月, 2007 2 次提交
    • R
      IB/umad: Fix bit ordering and 32-on-64 problems on big endian systems · a394f83b
      Roland Dreier 提交于
      The declaration of struct ib_user_mad_reg_req.method_mask[] exported
      to userspace was an array of __u32, but the kernel internally treated
      it as a bitmap made up of longs.  This makes a difference for 64-bit
      big-endian kernels, where numbering the bits in an array of__u32 gives:
      
          |31.....0|63....31|95....64|127...96|
      
      while numbering the bits in an array of longs gives:
      
          |63..............0|127............64|
      
      64-bit userspace can handle this by just treating method_mask[] as an
      array of longs, but 32-bit userspace is really stuck: the meaning of
      the bits in method_mask[] depends on whether the kernel is 32-bit or
      64-bit, and there's no sane way for userspace to know that.
      
      Fix this by updating <rdma/ib_user_mad.h> to make it clear that
      method_mask[] is an array of longs, and using a compat_ioctl method to
      convert to an array of 64-bit longs to handle the 32-on-64 problem.
      This fixes the interface description to match existing behavior (so
      working binaries continue to work) in almost all situations, and gives
      consistent semantics in the case of 32-bit userspace that can run on
      either a 32-bit or 64-bit kernel, so that the same binary can work for
      both 32-on-32 and 32-on-64 systems.
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      a394f83b
    • R
      IB/umad: Add P_Key index support · 2be8e3ee
      Roland Dreier 提交于
      Add support for setting the P_Key index of sent MADs and getting the
      P_Key index of received MADs.  This requires a change to the layout of
      the ABI structure struct ib_user_mad_hdr, so to avoid breaking
      compatibility, we default to the old (unchanged) ABI and add a new
      ioctl IB_USER_MAD_ENABLE_PKEY that allows applications that are aware
      of the new ABI to opt into using it.
      
      We plan on switching to the new ABI by default in a year or so, and
      this patch adds a warning that is printed when an application uses the
      old ABI, to push people towards converting to the new ABI.
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      Reviewed-by: NSean Hefty <sean.hefty@intel.com>
      Reviewed-by: NHal Rosenstock <hal@xsigo.com>
      2be8e3ee
  25. 03 5月, 2007 1 次提交
    • J
      PCI: Cleanup the includes of <linux/pci.h> · 6473d160
      Jean Delvare 提交于
      I noticed that many source files include <linux/pci.h> while they do
      not appear to need it. Here is an attempt to clean it all up.
      
      In order to find all possibly affected files, I searched for all
      files including <linux/pci.h> but without any other occurence of "pci"
      or "PCI". I removed the include statement from all of these, then I
      compiled an allmodconfig kernel on both i386 and x86_64 and fixed the
      false positives manually.
      
      My tests covered 66% of the affected files, so there could be false
      positives remaining. Untested files are:
      
      arch/alpha/kernel/err_common.c
      arch/alpha/kernel/err_ev6.c
      arch/alpha/kernel/err_ev7.c
      arch/ia64/sn/kernel/huberror.c
      arch/ia64/sn/kernel/xpnet.c
      arch/m68knommu/kernel/dma.c
      arch/mips/lib/iomap.c
      arch/powerpc/platforms/pseries/ras.c
      arch/ppc/8260_io/enet.c
      arch/ppc/8260_io/fcc_enet.c
      arch/ppc/8xx_io/enet.c
      arch/ppc/syslib/ppc4xx_sgdma.c
      arch/sh64/mach-cayman/iomap.c
      arch/xtensa/kernel/xtensa_ksyms.c
      arch/xtensa/platform-iss/setup.c
      drivers/i2c/busses/i2c-at91.c
      drivers/i2c/busses/i2c-mpc.c
      drivers/media/video/saa711x.c
      drivers/misc/hdpuftrs/hdpu_cpustate.c
      drivers/misc/hdpuftrs/hdpu_nexus.c
      drivers/net/au1000_eth.c
      drivers/net/fec_8xx/fec_main.c
      drivers/net/fec_8xx/fec_mii.c
      drivers/net/fs_enet/fs_enet-main.c
      drivers/net/fs_enet/mac-fcc.c
      drivers/net/fs_enet/mac-fec.c
      drivers/net/fs_enet/mac-scc.c
      drivers/net/fs_enet/mii-bitbang.c
      drivers/net/fs_enet/mii-fec.c
      drivers/net/ibm_emac/ibm_emac_core.c
      drivers/net/lasi_82596.c
      drivers/parisc/hppb.c
      drivers/sbus/sbus.c
      drivers/video/g364fb.c
      drivers/video/platinumfb.c
      drivers/video/stifb.c
      drivers/video/valkyriefb.c
      include/asm-arm/arch-ixp4xx/dma.h
      sound/oss/au1550_ac97.c
      
      I would welcome test reports for these files. I am fine with removing
      the untested files from the patch if the general opinion is that these
      changes aren't safe. The tested part would still be nice to have.
      
      Note that this patch depends on another header fixup patch I submitted
      to LKML yesterday:
        [PATCH] scatterlist.h needs types.h
        http://lkml.org/lkml/2007/3/01/141Signed-off-by: NJean Delvare <khali@linux-fr.org>
      Cc: Badari Pulavarty <pbadari@us.ibm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      6473d160
  26. 25 4月, 2007 1 次提交
  27. 19 4月, 2007 1 次提交
  28. 13 2月, 2007 1 次提交
  29. 23 9月, 2006 1 次提交