<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/target, branch v3.6</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v3.6</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v3.6'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2012-09-07T18:32:54Z</updated>
<entry>
<title>target: go through normal processing for zero-length REQUEST_SENSE</title>
<updated>2012-09-07T18:32:54Z</updated>
<author>
<name>Paolo Bonzini</name>
<email>pbonzini@redhat.com</email>
</author>
<published>2012-09-07T15:30:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6abbdf38363f064c8a50150c9b709682764483b3'/>
<id>urn:sha1:6abbdf38363f064c8a50150c9b709682764483b3</id>
<content type='text'>
Now that spc_emulate_request_sense has been taught to process zero-length
REQUEST SENSE correctly, drop the special handling of unit attention
conditions from transport_generic_new_cmd.  However, for now REQUEST SENSE
will be the only command that goes through emulation for zero lengths.

(nab: Fix up zero-length check in transport_generic_new_cmd)

Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
</entry>
<entry>
<title>target: support zero allocation length in REQUEST SENSE</title>
<updated>2012-09-07T18:14:21Z</updated>
<author>
<name>Paolo Bonzini</name>
<email>pbonzini@redhat.com</email>
</author>
<published>2012-09-07T15:30:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=32a8811ff164f882712c17946e58e52444f464a7'/>
<id>urn:sha1:32a8811ff164f882712c17946e58e52444f464a7</id>
<content type='text'>
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: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
</entry>
<entry>
<title>target: support zero-size allocation lengths in transport_kmap_data_sg</title>
<updated>2012-09-07T18:10:32Z</updated>
<author>
<name>Paolo Bonzini</name>
<email>pbonzini@redhat.com</email>
</author>
<published>2012-09-07T15:30:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3717ef0c63e90686d959158e9728a13a49229be6'/>
<id>urn:sha1:3717ef0c63e90686d959158e9728a13a49229be6</id>
<content type='text'>
In order to support zero-size allocation lengths, do not assert
that we have a scatterlist until after checking cmd-&gt;data_length.

But once we do this, we can have two cases of transport_kmap_data_sg
returning NULL: a zero-size allocation length, or an out-of-memory
condition.  Report the latter using sense codes, so that the SCSI
command that triggered it will fail.

Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
</entry>
<entry>
<title>target: fail REPORT LUNS with less than 16 bytes of payload</title>
<updated>2012-09-07T18:09:14Z</updated>
<author>
<name>Paolo Bonzini</name>
<email>pbonzini@redhat.com</email>
</author>
<published>2012-09-07T15:30:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9b16b9edb4fd0dc86ee0fbe1f7ede580e26e85f4'/>
<id>urn:sha1:9b16b9edb4fd0dc86ee0fbe1f7ede580e26e85f4</id>
<content type='text'>
SPC says:

"The ALLOCATION LENGTH field is defined in 4.3.5.6. The allocation length
should be at least 16.  Device servers compliant with SPC return CHECK
CONDITION status, with the sense key set to ILLEGAL REQUEST, and the
additional sense code set to INVALID FIELD IN CDB when the allocation
length is less than 16 bytes".

Testcase: sg_raw -r8 /dev/sdb a0 00 00 00 00 00 00 00 00 08 00 00
    should fail with ILLEGAL REQUEST / INVALID FIELD IN CDB sense
    does not fail without the patch
    fails correctly with the patch

Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
</entry>
<entry>
<title>target: report too-small parameter lists everywhere</title>
<updated>2012-09-07T18:09:08Z</updated>
<author>
<name>Paolo Bonzini</name>
<email>pbonzini@redhat.com</email>
</author>
<published>2012-09-07T15:30:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0d7f1299ca5540b9a63ab6e8bf0e89ea963eb6af'/>
<id>urn:sha1:0d7f1299ca5540b9a63ab6e8bf0e89ea963eb6af</id>
<content type='text'>
Several places were not checking that the parameter list length
was large enough, and thus accessing invalid memory.  Zero-length
parameter lists are just a special case of this.

Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
</entry>
<entry>
<title>target: go through normal processing for zero-length PSCSI commands</title>
<updated>2012-09-07T18:04:08Z</updated>
<author>
<name>Paolo Bonzini</name>
<email>pbonzini@redhat.com</email>
</author>
<published>2012-09-07T15:30:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=306c11b28d7bb85a7adda741798a2b6b60dd305a'/>
<id>urn:sha1:306c11b28d7bb85a7adda741798a2b6b60dd305a</id>
<content type='text'>
Right now, commands with a zero-size payload are skipped completely.
This is wrong; such commands should be passed down to the device and
processed normally.

For physical backends, this ignores completely things such as START
STOP UNIT.  For virtual backends, we have a hack in place to clear a
unit attention state on a zero-size REQUEST SENSE, but we still do
not report errors properly on zero-length commands---out-of-bounds
0-block reads and writes, too small parameter list lengths, etc.

This patch fixes this for PSCSI.  Uses of transport_kmap_data_sg are
guarded with a check for non-zero cmd-&gt;data_length; for all other
commands a zero length is handled properly in pscsi_execute_cmd.
The sole exception will be for now REPORT LUNS, which is handled
through the normal SPC emulation.

Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
</entry>
<entry>
<title>target: fix use-after-free with PSCSI sense data</title>
<updated>2012-09-06T00:20:28Z</updated>
<author>
<name>Paolo Bonzini</name>
<email>pbonzini@redhat.com</email>
</author>
<published>2012-09-05T15:09:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d5829eac5f7cfff89c6d1cf11717eee97cf030d0'/>
<id>urn:sha1:d5829eac5f7cfff89c6d1cf11717eee97cf030d0</id>
<content type='text'>
The pointer to the sense buffer is fetched by transport_get_sense_data,
but this is called by target_complete_ok_work long after pscsi_req_done
has freed the struct that contains it.

Pass instead the fabric's sense buffer to transport_complete,
and copy the data to it directly in transport_complete.  Setting
SCF_TRANSPORT_TASK_SENSE also becomes a duty of transport_complete.

Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
</entry>
<entry>
<title>target: simplify code around transport_get_sense_data</title>
<updated>2012-09-06T00:20:19Z</updated>
<author>
<name>Paolo Bonzini</name>
<email>pbonzini@redhat.com</email>
</author>
<published>2012-09-05T15:09:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=27a2709912ac19c755d34c79fe11994b0bf8082b'/>
<id>urn:sha1:27a2709912ac19c755d34c79fe11994b0bf8082b</id>
<content type='text'>
The error conditions in transport_get_sense_data are superfluous
and complicate the code unnecessarily:

* SCF_TRANSPORT_TASK_SENSE is checked in the caller;

* it's simply part of the invariants of dev-&gt;transport-&gt;get_sense_buffer
  that it must be there if transport_complete ever returns 1, and that
  it must not return NULL.  Besides, the entire callback will disappear
  with the next patch.

* similarly in the caller we can expect that sense data is only sent
  for non-zero cmd-&gt;scsi_status.

Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
</entry>
<entry>
<title>target: move transport_get_sense_data</title>
<updated>2012-09-06T00:19:46Z</updated>
<author>
<name>Paolo Bonzini</name>
<email>pbonzini@redhat.com</email>
</author>
<published>2012-09-05T15:09:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6138ed2ab8791d7a9c5ba66cadadd5eaf1fc1dac'/>
<id>urn:sha1:6138ed2ab8791d7a9c5ba66cadadd5eaf1fc1dac</id>
<content type='text'>
We will be calling it from transport_complete_cmd, avoid forward
declarations.  No semantic change.

Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
</entry>
<entry>
<title>target: Check idr_get_new return value in iscsi_login_zero_tsih_s1</title>
<updated>2012-08-27T06:27:08Z</updated>
<author>
<name>Benjamin Wang</name>
<email>cpwang2009@gmail.com</email>
</author>
<published>2012-08-26T10:04:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=13b5533a38b1eec9d61a07711dc075f03ae47a36'/>
<id>urn:sha1:13b5533a38b1eec9d61a07711dc075f03ae47a36</id>
<content type='text'>
This patch updates iscsi_login_zero_tsih_s1() usage for generating
iscsi_session-&gt;session_index to properly check the return value from
idr_get_new(), and reject the iSCSI login attempt with exception
status ISCSI_LOGIN_STATUS_NO_RESOURCES in the event of a failure.

Signed-off-by: Benjamin Wang &lt;cpwang2009@gmail.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
</entry>
</feed>
