Skip to content
Snippets Groups Projects
  1. Sep 14, 2021
  2. Jul 31, 2021
  3. Jul 29, 2021
  4. Jun 30, 2021
  5. Jun 01, 2021
  6. Jan 25, 2021
  7. Jan 03, 2020
    • Arnd Bergmann's avatar
      compat_ioctl: bsg: add handler · fe0da4e5
      Arnd Bergmann authored
      
      bsg_ioctl() calls into scsi_cmd_ioctl() for a couple of generic commands
      and relies on fs/compat_ioctl.c to handle it correctly in compat mode.
      
      Adding a private compat_ioctl() handler avoids that round-trip and lets
      us get rid of the generic emulation once this is done.
      
      Note that bsg implements an SG_IO command that is different from the
      other drivers and does not need emulation.
      
      Reviewed-by: default avatarBen Hutchings <ben.hutchings@codethink.co.uk>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      fe0da4e5
  8. Apr 30, 2019
  9. Feb 06, 2019
  10. Dec 21, 2018
    • Christoph Hellwig's avatar
      bsg: deprecate BIDI support in bsg · 2e5b2d7c
      Christoph Hellwig authored
      
      Besides the OSD command set that never got traction, the only SCSI
      command using bidirectional buffers is XDWRITEREAD in the 10 and 32 byte
      variants, which is extremely esoteric and has been removed from the spec
      again as of SBC4r15.  It probably doesn't make sense to keep the support
      code around just for that, so start deprecating the support.
      
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      2e5b2d7c
  11. Nov 16, 2018
  12. Aug 28, 2018
  13. Jul 12, 2018
    • Christoph Hellwig's avatar
      bsg: remove read/write support · 28519c89
      Christoph Hellwig authored
      
      The code poses a security risk due to user memory access in ->release
      and had an API that can't be used reliably.  As far as we know it was
      never used for real, but if that turns out wrong we'll have to revert
      this commit and come up with a band aid.
      
      Jann Horn did look software archives for users of this interface,
      and the only users found were example code in sg3_utils, and optional
      support in an optional module of the tgt user space iscsi target,
      which looks like a proof of concept extension of the /dev/sg
      read/write support.
      
      Tony Battersby chimes in that the code is basically unsafe to use in
      general:
      
        The read/write interface on /dev/bsg is impossible to use safely
        because the list of completed commands is per-device (bd->done_list)
        rather than per-fd like it is with /dev/sg.  So if program A and
        program B are both using the write/read interface on the same bsg
        device, then their command responses will get mixed up, and program
        A will read() some command results from program B and vice versa.
        So no, I don't use read/write on /dev/bsg.  From a security standpoint,
        it should definitely be fixed or removed.
      
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      28519c89
  14. Jul 11, 2018
  15. Jun 15, 2018
  16. May 29, 2018
  17. May 14, 2018
  18. Mar 13, 2018
    • Christoph Hellwig's avatar
      bsg: split handling of SCSI CDBs vs transport requeues · 17cb960f
      Christoph Hellwig authored
      
      The current BSG design tries to shoe-horn the transport-specific
      passthrough commands into the overall framework for SCSI passthrough
      requests.  This has a couple problems:
      
       - each passthrough queue has to set the QUEUE_FLAG_SCSI_PASSTHROUGH flag
         despite not dealing with SCSI commands at all.  Because of that these
         queues could also incorrectly accept SCSI commands from in-kernel
         users or through the legacy SCSI_IOCTL_SEND_COMMAND ioctl.
       - the real SCSI bsg queues also incorrectly accept bsg requests of the
         BSG_SUB_PROTOCOL_SCSI_TRANSPORT type
       - the bsg transport code is almost unredable because it tries to reuse
         different SCSI concepts for its own purpose.
      
      This patch instead adds a new bsg_ops structure to handle the two cases
      differently, and thus solves all of the above problems.  Another side
      effect is that the bsg-lib queues also don't need to embedd a
      struct scsi_request anymore.
      
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
      Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      17cb960f
  19. Feb 11, 2018
    • Linus Torvalds's avatar
      vfs: do bulk POLL* -> EPOLL* replacement · a9a08845
      Linus Torvalds authored
      
      This is the mindless scripted replacement of kernel use of POLL*
      variables as described by Al, done by this script:
      
          for V in IN OUT PRI ERR RDNORM RDBAND WRNORM WRBAND HUP RDHUP NVAL MSG; do
              L=`git grep -l -w POLL$V | grep -v '^t' | grep -v /um/ | grep -v '^sa' | grep -v '/poll.h$'|grep -v '^D'`
              for f in $L; do sed -i "-es/^\([^\"]*\)\(\<POLL$V\>\)/\\1E\\2/" $f; done
          done
      
      with de-mangling cleanups yet to come.
      
      NOTE! On almost all architectures, the EPOLL* constants have the same
      values as the POLL* constants do.  But they keyword here is "almost".
      For various bad reasons they aren't the same, and epoll() doesn't
      actually work quite correctly in some cases due to this on Sparc et al.
      
      The next patch from Al will sort out the final differences, and we
      should be all done.
      
      Scripted-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a9a08845
  20. Jan 24, 2018
  21. Nov 27, 2017
  22. Nov 11, 2017
  23. Aug 29, 2017
  24. Jun 21, 2017
    • Bart Van Assche's avatar
      block: Make most scsi_req_init() calls implicit · ca18d6f7
      Bart Van Assche authored
      
      Instead of explicitly calling scsi_req_init() after blk_get_request(),
      call that function from inside blk_get_request(). Add an
      .initialize_rq_fn() callback function to the block drivers that need
      it. Merge the IDE .init_rq_fn() function into .initialize_rq_fn()
      because it is too small to keep it as a separate function. Keep the
      scsi_req_init() call in ide_prep_sense() because it follows a
      blk_rq_init() call.
      
      References: commit 82ed4db4 ("block: split scsi_request out of struct request")
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.com>
      Cc: Omar Sandoval <osandov@fb.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      ca18d6f7
  25. Jun 09, 2017
    • Christoph Hellwig's avatar
      block: introduce new block status code type · 2a842aca
      Christoph Hellwig authored
      
      Currently we use nornal Linux errno values in the block layer, and while
      we accept any error a few have overloaded magic meanings.  This patch
      instead introduces a new  blk_status_t value that holds block layer specific
      status codes and explicitly explains their meaning.  Helpers to convert from
      and to the previous special meanings are provided for now, but I suspect
      we want to get rid of them in the long run - those drivers that have a
      errno input (e.g. networking) usually get errnos that don't know about
      the special block layer overloads, and similarly returning them to userspace
      will usually return somethings that strictly speaking isn't correct
      for file system operations, but that's left as an exercise for later.
      
      For now the set of errors is a very limited set that closely corresponds
      to the previous overloaded errno values, but there is some low hanging
      fruite to improve it.
      
      blk_status_t (ab)uses the sparse __bitwise annotations to allow for sparse
      typechecking, so that we can easily catch places passing the wrong values.
      
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      2a842aca
  26. Jun 01, 2017
  27. Apr 20, 2017
  28. Mar 28, 2017
  29. Feb 28, 2017
  30. Jan 31, 2017
    • Christoph Hellwig's avatar
      block: fold cmd_type into the REQ_OP_ space · aebf526b
      Christoph Hellwig authored
      
      Instead of keeping two levels of indirection for requests types, fold it
      all into the operations.  The little caveat here is that previously
      cmd_type only applied to struct request, while the request and bio op
      fields were set to plain REQ_OP_READ/WRITE even for passthrough
      operations.
      
      Instead this patch adds new REQ_OP_* for SCSI passthrough and driver
      private requests, althought it has to add two for each so that we
      can communicate the data in/out nature of the request.
      
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      aebf526b
  31. Jan 27, 2017
  32. Dec 23, 2016
  33. Nov 03, 2016
Loading