1. 01 11月, 2012 1 次提交
    • N
      target: Re-add explict zeroing of INQUIRY bounce buffer memory · dea5f099
      Nicholas Bellinger 提交于
      This patch fixes a regression in spc_emulate_inquiry() code where the
      local scope bounce buffer was no longer getting it's memory zeroed,
      causing various problems with SCSI initiators that depend upon areas
      of INQUIRY EVPD=0x83 payload having been zeroed.
      
      This bug was introduced with the following v3.7-rc1 patch + CC'ed
      stable commit:
      
      commit ffe7b0e9
      Author: Paolo Bonzini <pbonzini@redhat.com>
      Date:   Fri Sep 7 17:30:38 2012 +0200
      
          target: support zero allocation length in INQUIRY
      
      Go ahead and re-add the missing memset of bounce buffer memory to be
      copied into the outgoing se_cmd descriptor kmapped SGL payload.
      Reported-by: NKelsey Prantis <kelsey.prantis@intel.com>
      Cc: Kelsey Prantis <kelsey.prantis@intel.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Andy Grover <agrover@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      dea5f099
  2. 18 9月, 2012 2 次提交
    • P
      target: fix truncation of mode data, support zero allocation length · 7a3f369c
      Paolo Bonzini 提交于
      The offset was not bumped back to the full size after writing the
      header of the MODE SENSE response, so the last 1 or 2 bytes were
      not copied.
      
      On top of this, support zero-length requests by checking for the
      return value of transport_kmap_data_sg.
      
      Testcase: sg_raw -r20 /dev/sdb 5a 00 0a 00 00 00 00 00 14 00
          last byte should be 0x1e
          it is 0x00 without the patch
          it is correct with the patch
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      7a3f369c
    • P
      target: support zero allocation length in INQUIRY · ffe7b0e9
      Paolo Bonzini 提交于
      INQUIRY processing already uses an on-heap bounce buffer for loopback,
      but not for other fabrics.  Switch this to a cheaper on-stack bounce
      buffer, similar to the one used by MODE SENSE and REQUEST SENSE, and
      use it unconditionally.  With this in place, zero allocation length is
      handled simply by checking the return address of transport_kmap_data_sg.
      
      Testcase: sg_raw /dev/sdb 12 00 83 00 00 00
          should fail with ILLEGAL REQUEST / INVALID FIELD IN CDB sense
          does not fail without the patch
          fails correctly with the series
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      ffe7b0e9
  3. 08 9月, 2012 1 次提交
    • P
      target: support zero allocation length in REQUEST SENSE · 32a8811f
      Paolo Bonzini 提交于
      Similar to INQUIRY and MODE SENSE, construct the sense data in a
      buffer and later copy it to the scatterlist.  Do not do anything,
      but still clear a pending unit attention condition, if the allocation
      length is zero.
      
      However, SPC tells us that "If a REQUEST SENSE command is terminated with
      CHECK CONDITION status [and] the REQUEST SENSE command was received on
      an I_T nexus with a pending unit attention condition (i.e., before the
      device server reports CHECK CONDITION status), then the device server
      shall not clear the pending unit attention condition."  Do the
      transport_kmap_data_sg early to detect this case.
      
      It also tells us "Device servers shall not adjust the additional sense
      length to reflect truncation if the allocation length is less than the
      sense data available", so do not do that!  Note that the err variable
      is write-only.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      32a8811f
  4. 17 7月, 2012 4 次提交