1. 13 3月, 2009 1 次提交
    • T
      [SCSI] sg: fix races during device removal · c6517b79
      Tony Battersby 提交于
      sg has the following problems related to device removal:
      
      * opening a sg fd races with removing a device
      * closing a sg fd races with removing a device
      * /proc/scsi/sg/* access races with removing a device
      * command completion races with removing a device
      * command completion races with closing a sg fd
      * can rmmod sg with active commands
      
      These problems can cause kernel oopses, memory-use-after-free, or
      double-free errors.  This patch fixes these problems by using krefs
      to manage the lifetime of sg_device and sg_fd.
      
      Each command submitted to the midlevel holds a reference to sg_fd
      until the completion callback.  This ensures that sg_fd doesn't go
      away if the fd is closed with commands still outstanding.
      
      sg_fd gets the reference of sg_device (with scsi_device) and also
      makes sure that the sg module doesn't go away.
      
      /proc/scsi/sg/* functions don't play nicely with krefs because they
      give information about sg_fds which have been closed but not yet
      freed due to still having outstanding commands and sg_devices which
      have been removed but not yet freed due to still being referenced
      by one or more sg_fds.  To deal with this safely without removing
      functionality, /proc functions now access sg_device and sg_fd while
      holding a lock instead of using kref_get()/kref_put().
      Signed-off-by: NTony Battersby <tonyb@cybernetics.com>
      Acked-by: NDouglas Gilbert <dgilbert@interlog.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      c6517b79
  2. 11 2月, 2009 1 次提交
  3. 03 1月, 2009 2 次提交
  4. 02 11月, 2008 1 次提交
    • A
      saner FASYNC handling on file close · 233e70f4
      Al Viro 提交于
      As it is, all instances of ->release() for files that have ->fasync()
      need to remember to evict file from fasync lists; forgetting that
      creates a hole and we actually have a bunch that *does* forget.
      
      So let's keep our lives simple - let __fput() check FASYNC in
      file->f_flags and call ->fasync() there if it's been set.  And lose that
      crap in ->release() instances - leaving it there is still valid, but we
      don't have to bother anymore.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      233e70f4
  5. 21 10月, 2008 1 次提交
  6. 17 10月, 2008 1 次提交
  7. 09 10月, 2008 13 次提交
  8. 27 8月, 2008 2 次提交
    • F
      sg: restore command permission for TYPE_SCANNER · 14e507b8
      FUJITA Tomonori 提交于
      sg allowed any command for TYPE_SCANNER. The cmd_filter patchset
      doesn't. We can't change sg's permission since it might break the
      existing software.
      Signed-off-by: NFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      14e507b8
    • F
      block: move cmdfilter from gendisk to request_queue · abf54393
      FUJITA Tomonori 提交于
      cmd_filter works only for the block layer SG_IO with SCSI block
      devices. It breaks scsi/sg.c, bsg, and the block layer SG_IO with SCSI
      character devices (such as st). We hit a kernel crash with them.
      
      The problem is that cmd_filter code accesses to gendisk (having struct
      blk_scsi_cmd_filter) via inode->i_bdev->bd_disk. It works for only
      SCSI block device files. With character device files, inode->i_bdev
      leads you to struct cdev. inode->i_bdev->bd_disk->blk_scsi_cmd_filter
      isn't safe.
      
      SCSI ULDs don't expose gendisk; they keep it private. bsg needs to be
      independent on any protocols. We shouldn't change ULDs to expose their
      gendisk.
      
      This patch moves struct blk_scsi_cmd_filter from gendisk to
      request_queue, a common object, which eveyone can access to.
      
      The user interface doesn't change; users can change the filters via
      /sys/block/. gendisk has a pointer to request_queue so the cmd_filter
      code accesses to struct blk_scsi_cmd_filter.
      Signed-off-by: NFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      abf54393
  9. 05 8月, 2008 1 次提交
  10. 12 7月, 2008 1 次提交
  11. 03 7月, 2008 3 次提交
  12. 21 6月, 2008 1 次提交
  13. 21 5月, 2008 1 次提交
    • G
      SCSI: fix race in device_create · 24b42566
      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().  It fixes the problem in all of the scsi
      drivers that need it.
      
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Cc: Doug Gilbert <dgilbert@interlog.com>
      Cc: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      24b42566
  14. 29 4月, 2008 1 次提交
  15. 20 4月, 2008 1 次提交
  16. 08 2月, 2008 1 次提交
  17. 28 1月, 2008 1 次提交
  18. 24 1月, 2008 4 次提交
  19. 29 10月, 2007 1 次提交
  20. 24 10月, 2007 1 次提交
  21. 23 10月, 2007 1 次提交