<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/infiniband/ulp/srp, branch linux-4.3.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.3.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.3.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2015-09-03T19:59:48Z</updated>
<entry>
<title>IB/srp: Fix possible protection fault</title>
<updated>2015-09-03T19:59:48Z</updated>
<author>
<name>Sagi Grimberg</name>
</author>
<published>2015-08-24T16:04:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7fbc67df2cd6d0b72fd5d6d3acaa79ab6f5b0224'/>
<id>urn:sha1:7fbc67df2cd6d0b72fd5d6d3acaa79ab6f5b0224</id>
<content type='text'>
srp_destroy_qp is designed to indicate we are safe to continue with
freeing the channel resources by modifying the qp error state,
posting a dummy wr on the queue-pair and waiting for it to flush.
This also holds for the channel registration pool as we are unmapping
the memory region when handling a scsi response. Destroying the
channel registration pool before we make sure we processed all the
inflight IO might introduce a use-after-free of the registration pool.

This use-after-free is demonstrated in the stack trace below where
srp is trying to unmap a used FMR after the fmr_pool was already destroyed.

general protection fault: 0000 [#1] SMP
RIP: 0010:[&lt;ffffffff8151121b&gt;]  [&lt;ffffffff8151121b&gt;] _raw_spin_lock_irqsave+0x1b/0x50
Call Trace:
 [&lt;ffffffffa055d88a&gt;] ib_fmr_pool_unmap+0x1a/0xb0 [ib_core]
 [&lt;ffffffffa06c00ed&gt;] srp_unmap_data.isra.28+0x17d/0x250 [ib_srp]
 [&lt;ffffffffa06c01eb&gt;] srp_free_req+0x2b/0x60 [ib_srp]
 [&lt;ffffffffa06c0c94&gt;] srp_recv_completion+0x174/0x580 [ib_srp]
 [&lt;ffffffffa04580fe&gt;] mlx4_eq_int+0x4de/0xe50 [mlx4_core]
 [&lt;ffffffffa0458b00&gt;] mlx4_msi_x_interrupt+0x10/0x20 [mlx4_core]
 [&lt;ffffffff810abc45&gt;] handle_irq_event_percpu+0x35/0x1b0
 [&lt;ffffffff810abdf2&gt;] handle_irq_event+0x32/0x50
 [&lt;ffffffff810ae5cf&gt;] handle_edge_irq+0x6f/0x120
 [&lt;ffffffff8100455a&gt;] handle_irq+0x1a/0x30
 [&lt;ffffffff8151b475&gt;] do_IRQ+0x45/0xb0
 [&lt;ffffffff8151162d&gt;] common_interrupt+0x6d/0x6d
 [&lt;ffffffff813e4d2f&gt;] cpuidle_enter_state+0x4f/0xc0
 [&lt;ffffffff813e4e6c&gt;] cpuidle_idle_call+0xcc/0x210
 [&lt;ffffffff8100b9ea&gt;] arch_cpu_idle+0xa/0x30
 [&lt;ffffffff810ab1e1&gt;] cpu_startup_entry+0xe1/0x270
 [&lt;ffffffff81030b3a&gt;] start_secondary+0x21a/0x2c0

Reported-by: Eliott Kespi &lt;eliottk@mellanox.com&gt;
Signed-off-by: Sagi Grimberg &lt;sagig@mellanox.com&gt;
Signed-off-by: Bart Van Assche &lt;bart.vanassche@sandisk.com&gt;
Signed-off-by: Doug Ledford &lt;dledford@redhat.com&gt;
</content>
</entry>
<entry>
<title>IB/srp: Create an insecure all physical rkey only if needed</title>
<updated>2015-08-30T22:12:39Z</updated>
<author>
<name>Bart Van Assche</name>
</author>
<published>2015-08-11T00:09:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=03f6fb93fde24f01a940283bdf55024e576ee87d'/>
<id>urn:sha1:03f6fb93fde24f01a940283bdf55024e576ee87d</id>
<content type='text'>
The SRP initiator only needs this if the insecure register_always=N
performance optimization is enabled, or if FRWR/FMR is not supported
in the driver.

Do not create an all physical MR unless it is needed to support
either of those modes. Default register_always to true so the out of
the box configuration does not create an insecure all physical MR.

Signed-off-by: Jason Gunthorpe &lt;jgunthorpe@obsidianresearch.com&gt;
[bvanassche: reworked and rebased this patch]
Signed-off-by: Bart Van Assche &lt;bart.vanassche@sandisk.com&gt;
Signed-off-by: Doug Ledford &lt;dledford@redhat.com&gt;
</content>
</entry>
<entry>
<title>IB/srp: Register the indirect data buffer descriptor</title>
<updated>2015-08-30T22:12:38Z</updated>
<author>
<name>Bart Van Assche</name>
</author>
<published>2015-08-11T00:09:05Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=330179f2fa93c1c6c41a90c7deabc98e363018e5'/>
<id>urn:sha1:330179f2fa93c1c6c41a90c7deabc98e363018e5</id>
<content type='text'>
Instead of always using the global rkey for the indirect data
buffer descriptor, register that descriptor with the HCA if
the kernel module parameter register_always has been set to Y.

Signed-off-by: Bart Van Assche &lt;bart.vanassche@sandisk.com&gt;
Signed-off-by: Doug Ledford &lt;dledford@redhat.com&gt;
</content>
</entry>
<entry>
<title>IB/srp: Introduce srp_device.use_fmr</title>
<updated>2015-08-30T22:12:38Z</updated>
<author>
<name>Bart Van Assche</name>
</author>
<published>2015-08-11T00:08:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=002f15674c84fb4c38ed5237c1e7235e09c033f0'/>
<id>urn:sha1:002f15674c84fb4c38ed5237c1e7235e09c033f0</id>
<content type='text'>
Introduce the variable srp_device.use_fmr. Leave out the dev-&gt;has_fr /
dev-&gt;has_fmr and ch-&gt;fr_pool / ch-&gt;fmr_pool checks since these are
redundant. This patch does not change any functionality but makes the
source code easier to read.

Signed-off-by: Bart Van Assche &lt;bart.vanassche@sandisk.com&gt;
Signed-off-by: Doug Ledford &lt;dledford@redhat.com&gt;
</content>
</entry>
<entry>
<title>IB/srp: Remove use_mr argument from srp_map_sg_entry()</title>
<updated>2015-08-30T22:12:38Z</updated>
<author>
<name>Bart Van Assche</name>
</author>
<published>2015-08-11T00:08:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3ae95da8831e7bcf7b6da2b31cb4b50b3058f14e'/>
<id>urn:sha1:3ae95da8831e7bcf7b6da2b31cb4b50b3058f14e</id>
<content type='text'>
Move the srp_map_desc() call from inside srp_map_sg_entry() to
srp_map_sg() such that the use_mr argument can be removed from
srp_map_sg_entry().

Signed-off-by: Bart Van Assche &lt;bart.vanassche@sandisk.com&gt;
Signed-off-by: Doug Ledford &lt;dledford@redhat.com&gt;
</content>
</entry>
<entry>
<title>IB/srp: Remove the memory registration backtracking code</title>
<updated>2015-08-30T22:12:37Z</updated>
<author>
<name>Bart Van Assche</name>
</author>
<published>2015-08-11T00:07:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0e0d3a480090d03f29e58dfd717960776f3416d9'/>
<id>urn:sha1:0e0d3a480090d03f29e58dfd717960776f3416d9</id>
<content type='text'>
Mapping a discontiguous sg-list requires multiple memory regions
and hence can exhaust the memory region pool. The SRP initiator
already handles this by temporarily reducing the queue depth. This
means that it is safe to remove the memory registration backtracking
code. This patch has been tested with direct I/O sizes up to 256 MB.

Signed-off-by: Bart Van Assche &lt;bart.vanassche@sandisk.com&gt;
Signed-off-by: Doug Ledford &lt;dledford@redhat.com&gt;
</content>
</entry>
<entry>
<title>IB/srp: Add memory descriptor array pointer range checking</title>
<updated>2015-08-30T22:12:37Z</updated>
<author>
<name>Bart Van Assche</name>
</author>
<published>2015-08-11T00:07:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f731ed62934ace0d3f5aa9ec557349171711be05'/>
<id>urn:sha1:f731ed62934ace0d3f5aa9ec557349171711be05</id>
<content type='text'>
Although most paths through which a request is submitted check
block layer parameters like the max_segments limit, these are
not checked when an SG_IO or direct I/O request is submitted.
Hence add a range check for the memory descriptor array pointer.

Signed-off-by: Bart Van Assche &lt;bart.vanassche@sandisk.com&gt;
Signed-off-by: Doug Ledford &lt;dledford@redhat.com&gt;
</content>
</entry>
<entry>
<title>IB/srp: Use multiple registrations for large memory regions</title>
<updated>2015-08-30T22:12:37Z</updated>
<author>
<name>Bart Van Assche</name>
</author>
<published>2015-08-11T00:06:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7e85c91970125cb16399c7d1cfedc943266eee49'/>
<id>urn:sha1:7e85c91970125cb16399c7d1cfedc943266eee49</id>
<content type='text'>
Instead of using the global rkey for large memory regions, use
multiple registrations. See also the while (dma_len) loop further
down in srp_map_sg_entry().

Signed-off-by: Bart Van Assche &lt;bart.vanassche@sandisk.com&gt;
Signed-off-by: Doug Ledford &lt;dledford@redhat.com&gt;
</content>
</entry>
<entry>
<title>IB/srp: Re-enable FMR for non-page aligned buffers</title>
<updated>2015-08-30T22:12:36Z</updated>
<author>
<name>Bart Van Assche</name>
</author>
<published>2015-08-11T00:06:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=186fbc6689a368364b7c9eb9d42d6f84b3079f65'/>
<id>urn:sha1:186fbc6689a368364b7c9eb9d42d6f84b3079f65</id>
<content type='text'>
During a discussion in 2011 nobody recalled why FMR was not used for
non-page aligned buffers (see also
http://thread.gmane.org/gmane.linux.drivers.rdma/7149). Re-enable FMR
for such buffers. For the reason why the srp_map_fmr() function needs
to be modified, see also patch "IB/srp: rework mapping engine to use
multiple FMR entries" (commit ID 8f26c9ff9cd0; January 2011).

Signed-off-by: Bart Van Assche &lt;bart.vanassche@sandisk.com&gt;
Signed-off-by: Doug Ledford &lt;dledford@redhat.com&gt;
</content>
</entry>
<entry>
<title>IB/srp: Use pd-&gt;local_dma_lkey</title>
<updated>2015-08-30T22:12:35Z</updated>
<author>
<name>Jason Gunthorpe</name>
</author>
<published>2015-07-30T23:22:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e6bf5f48d2adc443689c5e627bcd559b00201e5c'/>
<id>urn:sha1:e6bf5f48d2adc443689c5e627bcd559b00201e5c</id>
<content type='text'>
Replace all leys with  pd-&gt;local_dma_lkey. This driver does not support
iWarp, so this is safe.

The insecure use of ib_get_dma_mr is thus isolated to an rkey, and will
have to be fixed separately.

Signed-off-by: Jason Gunthorpe &lt;jgunthorpe@obsidianresearch.com&gt;
Reviewed-by: Sagi Grimberg &lt;sagig@mellanox.com&gt;
Reviewed-by: Bart Van Assche &lt;bart.vanassche@sandisk.com&gt;
Signed-off-by: Doug Ledford &lt;dledford@redhat.com&gt;
</content>
</entry>
</feed>
