<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/target/target_core_user.c, branch linux-4.9.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.9.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.9.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2020-09-03T09:21:16Z</updated>
<entry>
<title>scsi: target: tcmu: Fix crash on ARM during cmd completion</title>
<updated>2020-09-03T09:21:16Z</updated>
<author>
<name>Bodo Stroesser</name>
</author>
<published>2020-06-29T09:37:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0812b2b2363ab2f8f0a1e90639318114fc0cb7d0'/>
<id>urn:sha1:0812b2b2363ab2f8f0a1e90639318114fc0cb7d0</id>
<content type='text'>
[ Upstream commit 5a0c256d96f020e4771f6fd5524b80f89a2d3132 ]

If tcmu_handle_completions() has to process a padding shorter than
sizeof(struct tcmu_cmd_entry), the current call to
tcmu_flush_dcache_range() with sizeof(struct tcmu_cmd_entry) as length
param is wrong and causes crashes on e.g. ARM, because
tcmu_flush_dcache_range() in this case calls
flush_dcache_page(vmalloc_to_page(start)); with start being an invalid
address above the end of the vmalloc'ed area.

The fix is to use the minimum of remaining ring space and sizeof(struct
tcmu_cmd_entry) as the length param.

The patch was tested on kernel 4.19.118.

See https://bugzilla.kernel.org/show_bug.cgi?id=208045#c10

Link: https://lore.kernel.org/r/20200629093756.8947-1-bstroesser@ts.fujitsu.com
Tested-by: JiangYu &lt;lnsyyj@hotmail.com&gt;
Acked-by: Mike Christie &lt;michael.christie@oracle.com&gt;
Signed-off-by: Bodo Stroesser &lt;bstroesser@ts.fujitsu.com&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>tcmu: Skip Data-Out blocks before gathering Data-In buffer for BIDI case</title>
<updated>2017-04-21T07:31:18Z</updated>
<author>
<name>Xiubo Li</name>
</author>
<published>2017-03-31T02:35:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5ef6f4dec559007650c762b11ca30dd74866299a'/>
<id>urn:sha1:5ef6f4dec559007650c762b11ca30dd74866299a</id>
<content type='text'>
commit a5d68ba85801a78c892a0eb8efb711e293ed314b upstream.

For the bidirectional case, the Data-Out buffer blocks will always at
the head of the tcmu_cmd's bitmap, and before gathering the Data-In
buffer, first of all it should skip the Data-Out ones, or the device
supporting BIDI commands won't work.

Fixed: 26418649eead ("target/user: Introduce data_bitmap, replace
		data_length/data_head/data_tail")
Reported-by: Ilias Tsitsimpis &lt;iliastsi@arrikto.com&gt;
Tested-by: Ilias Tsitsimpis &lt;iliastsi@arrikto.com&gt;
Signed-off-by: Xiubo Li &lt;lixiubo@cmss.chinamobile.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>tcmu: Fix wrongly calculating of the base_command_size</title>
<updated>2017-04-21T07:31:18Z</updated>
<author>
<name>Xiubo Li</name>
</author>
<published>2017-03-27T09:07:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=890aec8eae096624763bc3de313d154a3ba9d9d6'/>
<id>urn:sha1:890aec8eae096624763bc3de313d154a3ba9d9d6</id>
<content type='text'>
commit abe342a5b4b5aa579f6bf40ba73447c699e6b579 upstream.

The t_data_nents and t_bidi_data_nents are the numbers of the
segments, but it couldn't be sure the block size equals to size
of the segment.

For the worst case, all the blocks are discontiguous and there
will need the same number of iovecs, that's to say: blocks == iovs.
So here just set the number of iovs to block count needed by tcmu
cmd.

Tested-by: Ilias Tsitsimpis &lt;iliastsi@arrikto.com&gt;
Reviewed-by: Mike Christie &lt;mchristi@redhat.com&gt;
Signed-off-by: Xiubo Li &lt;lixiubo@cmss.chinamobile.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>tcmu: Fix possible overwrite of t_data_sg's last iov[]</title>
<updated>2017-04-21T07:31:18Z</updated>
<author>
<name>Xiubo Li</name>
</author>
<published>2017-03-27T09:07:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ef599fa52429f7f8fea2d1bf83a49b0377c7dc24'/>
<id>urn:sha1:ef599fa52429f7f8fea2d1bf83a49b0377c7dc24</id>
<content type='text'>
commit ab22d2604c86ceb01bb2725c9860b88a7dd383bb upstream.

If there has BIDI data, its first iov[] will overwrite the last
iov[] for se_cmd-&gt;t_data_sg.

To fix this, we can just increase the iov pointer, but this may
introuduce a new memory leakage bug: If the se_cmd-&gt;data_length
and se_cmd-&gt;t_bidi_data_sg-&gt;length are all not aligned up to the
DATA_BLOCK_SIZE, the actual length needed maybe larger than just
sum of them.

So, this could be avoided by rounding all the data lengthes up
to DATA_BLOCK_SIZE.

Reviewed-by: Mike Christie &lt;mchristi@redhat.com&gt;
Tested-by: Ilias Tsitsimpis &lt;iliastsi@arrikto.com&gt;
Reviewed-by: Bryant G. Ly &lt;bryantly@linux.vnet.ibm.com&gt;
Signed-off-by: Xiubo Li &lt;lixiubo@cmss.chinamobile.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>target/user: Fix use-after-free of tcmu_cmds if they are expired</title>
<updated>2017-01-09T07:32:25Z</updated>
<author>
<name>Andy Grover</name>
</author>
<published>2016-11-22T00:35:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=173fd37a3d2135fcf17a3240a71ca9c79ae151ab'/>
<id>urn:sha1:173fd37a3d2135fcf17a3240a71ca9c79ae151ab</id>
<content type='text'>
commit d0905ca757bc40bd1ebc261a448a521b064777d7 upstream.

Don't free the cmd in tcmu_check_expired_cmd, it's still referenced by
an entry in our cmd_id-&gt;cmd idr. If userspace ever resumes processing,
tcmu_handle_completions() will use the now-invalid cmd pointer.

Instead, don't free cmd. It will be freed by tcmu_handle_completion() if
userspace ever recovers, or tcmu_free_device if not.

Reported-by: Bryant G Ly &lt;bgly@us.ibm.com&gt;
Tested-by: Bryant G Ly &lt;bgly@us.ibm.com&gt;
Signed-off-by: Andy Grover &lt;agrover@redhat.com&gt;
Signed-off-by: Bart Van Assche &lt;bart.vanassche@sandisk.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>target/user: Fix comments to not refer to data ring</title>
<updated>2016-10-20T04:22:23Z</updated>
<author>
<name>Andy Grover</name>
</author>
<published>2016-08-25T15:55:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3d9b95558f5874ac5d63a057813dc66b480de7e1'/>
<id>urn:sha1:3d9b95558f5874ac5d63a057813dc66b480de7e1</id>
<content type='text'>
We no longer use a ringbuffer for the data area, so this might cause
confusion. Just call it the data area.

Signed-off-by: Andy Grover &lt;agrover@redhat.com&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Mike Christie &lt;mchristi@redhat.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
</entry>
<entry>
<title>target/user: Return an error if cmd data size is too large</title>
<updated>2016-10-20T04:22:16Z</updated>
<author>
<name>Andy Grover</name>
</author>
<published>2016-08-25T15:55:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=554617b2bbe25c3fb3c80c28fe7a465884bb40b1'/>
<id>urn:sha1:554617b2bbe25c3fb3c80c28fe7a465884bb40b1</id>
<content type='text'>
Userspace should be implementing VPD B0 (Block Limits) to inform the
initiator of max data size, but just in case we do get a too-large request,
do what the spec says and return INVALID_CDB_FIELD.

Make sure to unlock udev-&gt;cmdr_lock before returning.

Signed-off-by: Andy Grover &lt;agrover@redhat.com&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Mike Christie &lt;mchristi@redhat.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
</entry>
<entry>
<title>target/user: Use sense_reason_t in tcmu_queue_cmd_ring</title>
<updated>2016-10-20T04:21:45Z</updated>
<author>
<name>Andy Grover</name>
</author>
<published>2016-10-06T15:07:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=02eb924fabc5b699c0d9d354491e6f0767e3c139'/>
<id>urn:sha1:02eb924fabc5b699c0d9d354491e6f0767e3c139</id>
<content type='text'>
Instead of using -ERROR-style returns, use sense_reason_t. This lets us
remove tcmu_pass_op(), and return more correct sense values.

Signed-off-by: Andy Grover &lt;agrover@redhat.com&gt;
Signed-off-by: Bryant G. Ly &lt;bryantly@linux.vnet.ibm.com&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Mike Christie &lt;mchristi@redhat.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
</entry>
<entry>
<title>target/user: Report capability of handling out-of-order completions to userspace</title>
<updated>2016-03-11T05:49:09Z</updated>
<author>
<name>Sheng Yang</name>
</author>
<published>2016-03-01T00:02:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=32c76de3466ed2a875e36c140ac4e3800fdfab6e'/>
<id>urn:sha1:32c76de3466ed2a875e36c140ac4e3800fdfab6e</id>
<content type='text'>
TCMU_MAILBOX_FLAG_CAP_OOOC was introduced, and userspace can check the flag
for out-of-order completion capability support.

Also update the document on how to use the feature.

Signed-off-by: Sheng Yang &lt;sheng@yasker.org&gt;
Reviewed-by: Andy Grover &lt;agrover@redhat.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
</entry>
<entry>
<title>target/user: Fix size_t format-spec build warning</title>
<updated>2016-03-11T05:49:06Z</updated>
<author>
<name>Nicholas Bellinger</name>
</author>
<published>2016-02-28T02:25:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0241fd39ce7bc9b82b7e57305cb0d6bb1364d45b'/>
<id>urn:sha1:0241fd39ce7bc9b82b7e57305cb0d6bb1364d45b</id>
<content type='text'>
Fix the following printk size_t warning as per 0-day build:

All warnings (new ones prefixed by &gt;&gt;):

   drivers/target/target_core_user.c: In function 'is_ring_space_avail':
&gt;&gt; drivers/target/target_core_user.c:385:12: warning: format '%lu'
&gt;&gt; expects argument of type 'long unsigned int', but argument 3 has type
&gt;&gt; 'size_t {aka unsigned int}' [-Wformat=]
      pr_debug("no data space: only %lu available, but ask for %lu\n",
               ^

Reported-by: kbuild test robot &lt;fengguang.wu@intel.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
</entry>
</feed>
