<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/crypto, branch v4.19.39</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v4.19.39</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v4.19.39'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2019-04-20T07:16:04+00:00</updated>
<entry>
<title>crypto: axis - fix for recursive locking from bottom half</title>
<updated>2019-04-20T07:16:04+00:00</updated>
<author>
<name>Lars Persson</name>
<email>lars.persson@axis.com</email>
</author>
<published>2019-01-23T11:59:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5f516d0ba082ccf1d0ca974568194153a1d434b9'/>
<id>urn:sha1:5f516d0ba082ccf1d0ca974568194153a1d434b9</id>
<content type='text'>
[ Upstream commit c34a83820f59bb275e5f2d55cd5ea99c64f6ef23 ]

Clients may submit a new requests from the completion callback
context. The driver was not prepared to receive a request in this
state because it already held the request queue lock and a recursive
lock error is triggered.

Now all completions are queued up until we are ready to drop the queue
lock and then delivered.

The fault was triggered by TCP over an IPsec connection in the LTP
test suite:
  LTP: starting tcp4_ipsec02 (tcp_ipsec.sh -p ah -m transport -s "100 1000 65535")
  BUG: spinlock recursion on CPU#1, genload/943
   lock: 0xbf3c3094, .magic: dead4ead, .owner: genload/943, .owner_cpu: 1
  CPU: 1 PID: 943 Comm: genload Tainted: G           O    4.9.62-axis5-devel #6
  Hardware name: Axis ARTPEC-6 Platform
   (unwind_backtrace) from [&lt;8010d134&gt;] (show_stack+0x18/0x1c)
   (show_stack) from [&lt;803a289c&gt;] (dump_stack+0x84/0x98)
   (dump_stack) from [&lt;8016e164&gt;] (do_raw_spin_lock+0x124/0x128)
   (do_raw_spin_lock) from [&lt;804de1a4&gt;] (artpec6_crypto_submit+0x2c/0xa0)
   (artpec6_crypto_submit) from [&lt;804def38&gt;] (artpec6_crypto_prepare_submit_hash+0xd0/0x54c)
   (artpec6_crypto_prepare_submit_hash) from [&lt;7f3165f0&gt;] (ah_output+0x2a4/0x3dc [ah4])
   (ah_output [ah4]) from [&lt;805df9bc&gt;] (xfrm_output_resume+0x178/0x4a4)
   (xfrm_output_resume) from [&lt;805d283c&gt;] (xfrm4_output+0xac/0xbc)
   (xfrm4_output) from [&lt;80587928&gt;] (ip_queue_xmit+0x140/0x3b4)
   (ip_queue_xmit) from [&lt;805a13b4&gt;] (tcp_transmit_skb+0x4c4/0x95c)
   (tcp_transmit_skb) from [&lt;8059f218&gt;] (tcp_rcv_state_process+0xdf4/0xdfc)
   (tcp_rcv_state_process) from [&lt;805a7530&gt;] (tcp_v4_do_rcv+0x64/0x1ac)
   (tcp_v4_do_rcv) from [&lt;805a9724&gt;] (tcp_v4_rcv+0xa34/0xb74)
   (tcp_v4_rcv) from [&lt;80581d34&gt;] (ip_local_deliver_finish+0x78/0x2b0)
   (ip_local_deliver_finish) from [&lt;8058259c&gt;] (ip_local_deliver+0xe4/0x104)
   (ip_local_deliver) from [&lt;805d23ec&gt;] (xfrm4_transport_finish+0xf4/0x144)
   (xfrm4_transport_finish) from [&lt;805df564&gt;] (xfrm_input+0x4f4/0x74c)
   (xfrm_input) from [&lt;804de420&gt;] (artpec6_crypto_task+0x208/0x38c)
   (artpec6_crypto_task) from [&lt;801271b0&gt;] (tasklet_action+0x60/0xec)
   (tasklet_action) from [&lt;801266d4&gt;] (__do_softirq+0xcc/0x3a4)
   (__do_softirq) from [&lt;80126d20&gt;] (irq_exit+0xf4/0x15c)
   (irq_exit) from [&lt;801741e8&gt;] (__handle_domain_irq+0x68/0xbc)
   (__handle_domain_irq) from [&lt;801014f0&gt;] (gic_handle_irq+0x50/0x94)
   (gic_handle_irq) from [&lt;80657370&gt;] (__irq_usr+0x50/0x80)

Signed-off-by: Lars Persson &lt;larper@axis.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>crypto: cavium/zip - fix collision with generic cra_driver_name</title>
<updated>2019-04-05T20:33:01+00:00</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2019-02-23T08:23:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b142c79733385c7fa502725c24d43b036b499220'/>
<id>urn:sha1:b142c79733385c7fa502725c24d43b036b499220</id>
<content type='text'>
[ Upstream commit 41798036430015ad45137db2d4c213cd77fd0251 ]

The cavium/zip implementation of the deflate compression algorithm is
incorrectly being registered under the generic driver name, which
prevents the generic implementation from being registered with the
crypto API when CONFIG_CRYPTO_DEV_CAVIUM_ZIP=y.  Similarly the lzs
algorithm (which does not currently have a generic implementation...)
is incorrectly being registered as lzs-generic.

Fix the naming collision by adding a suffix "-cavium" to the
cra_driver_name of the cavium/zip algorithms.

Fixes: 640035a2dc55 ("crypto: zip - Add ThunderX ZIP driver core")
Cc: Mahipal Challa &lt;mahipalreddy2006@gmail.com&gt;
Cc: Jan Glauber &lt;jglauber@cavium.com&gt;
Signed-off-by: Eric Biggers &lt;ebiggers@google.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>crypto: crypto4xx - add missing of_node_put after of_device_is_available</title>
<updated>2019-04-05T20:33:00+00:00</updated>
<author>
<name>Julia Lawall</name>
<email>Julia.Lawall@lip6.fr</email>
</author>
<published>2019-02-23T13:20:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d401d121113e9966804797137b69fb3f56ba33da'/>
<id>urn:sha1:d401d121113e9966804797137b69fb3f56ba33da</id>
<content type='text'>
[ Upstream commit 8c2b43d2d85b48a97d2f8279278a4aac5b45f925 ]

Add an of_node_put when a tested device node is not available.

The semantic patch that fixes this problem is as follows
(http://coccinelle.lip6.fr):

// &lt;smpl&gt;
@@
identifier f;
local idexpression e;
expression x;
@@

e = f(...);
... when != of_node_put(e)
    when != x = e
    when != e = x
    when any
if (&lt;+...of_device_is_available(e)...+&gt;) {
  ... when != of_node_put(e)
(
  return e;
|
+ of_node_put(e);
  return ...;
)
}
// &lt;/smpl&gt;

Fixes: 5343e674f32fb ("crypto4xx: integrate ppc4xx-rng into crypto4xx")
Signed-off-by: Julia Lawall &lt;Julia.Lawall@lip6.fr&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>crypto: rockchip - update new iv to device in multiple operations</title>
<updated>2019-03-23T19:09:41+00:00</updated>
<author>
<name>Zhang Zhijie</name>
<email>zhangzj@rock-chips.com</email>
</author>
<published>2019-02-13T08:24:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2e0e1f9a1e41fabfb945c67fd91145fca230dbb7'/>
<id>urn:sha1:2e0e1f9a1e41fabfb945c67fd91145fca230dbb7</id>
<content type='text'>
commit c1c214adcb56d36433480c8fedf772498e7e539c upstream.

For chain mode in cipher(eg. AES-CBC/DES-CBC), the iv is continuously
updated in the operation. The new iv value should be written to device
register by software.

Reported-by: Eric Biggers &lt;ebiggers@google.com&gt;
Fixes: 433cd2c617bf ("crypto: rockchip - add crypto driver for rk3288")
Cc: &lt;stable@vger.kernel.org&gt; # v4.5+
Signed-off-by: Zhang Zhijie &lt;zhangzj@rock-chips.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>crypto: rockchip - fix scatterlist nents error</title>
<updated>2019-03-23T19:09:41+00:00</updated>
<author>
<name>Zhang Zhijie</name>
<email>zhangzj@rock-chips.com</email>
</author>
<published>2019-02-13T08:24:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5aabf06712c2086168c5db9d96def40eaf6eb637'/>
<id>urn:sha1:5aabf06712c2086168c5db9d96def40eaf6eb637</id>
<content type='text'>
commit 4359669a087633132203c52d67dd8c31e09e7b2e upstream.

In some cases, the nents of src scatterlist is different from
dst scatterlist. So two variables are used to handle the nents
of src&amp;dst scatterlist.

Reported-by: Eric Biggers &lt;ebiggers@google.com&gt;
Fixes: 433cd2c617bf ("crypto: rockchip - add crypto driver for rk3288")
Cc: &lt;stable@vger.kernel.org&gt; # v4.5+
Signed-off-by: Zhang Zhijie &lt;zhangzj@rock-chips.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>crypto: ccree - don't copy zero size ciphertext</title>
<updated>2019-03-23T19:09:40+00:00</updated>
<author>
<name>Gilad Ben-Yossef</name>
<email>gilad@benyossef.com</email>
</author>
<published>2019-01-15T13:43:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6ed42ccca59db6c871f00c5746a769e5154324b6'/>
<id>urn:sha1:6ed42ccca59db6c871f00c5746a769e5154324b6</id>
<content type='text'>
commit 2b5ac17463dcb2411fed506edcf259a89bb538ba upstream.

For decryption in CBC mode we need to save the last ciphertext block
for use as the next IV. However, we were trying to do this also with
zero sized ciphertext resulting in a panic.

Fix this by only doing the copy if the ciphertext length is at least
of IV size.

Signed-off-by: Gilad Ben-Yossef &lt;gilad@benyossef.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>crypto: ccree - unmap buffer before copying IV</title>
<updated>2019-03-23T19:09:40+00:00</updated>
<author>
<name>Gilad Ben-Yossef</name>
<email>gilad@benyossef.com</email>
</author>
<published>2019-01-15T13:43:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0bdd345a384849d6d194dd84cd60b0ccc69fd8d1'/>
<id>urn:sha1:0bdd345a384849d6d194dd84cd60b0ccc69fd8d1</id>
<content type='text'>
commit c139c72e2beb3e3db5148910b3962b7322e24374 upstream.

We were copying the last ciphertext block into the IV field
for CBC before removing the DMA mapping of the output buffer
with the result of the buffer sometime being out-of-sync cache
wise and were getting intermittent cases of bad output IV.

Fix it by moving the DMA buffer unmapping before the copy.

Signed-off-by: Gilad Ben-Yossef &lt;gilad@benyossef.com&gt;
Fixes: 00904aa0cd59 ("crypto: ccree - fix iv handling")
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>crypto: ccree - fix free of unallocated mlli buffer</title>
<updated>2019-03-23T19:09:40+00:00</updated>
<author>
<name>Hadar Gat</name>
<email>hadar.gat@arm.com</email>
</author>
<published>2019-01-15T13:43:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=009eeb9878b480cec08ade74e94e21e04cc45a24'/>
<id>urn:sha1:009eeb9878b480cec08ade74e94e21e04cc45a24</id>
<content type='text'>
commit a49411959ea6d4915a9fd2a7eb5ba220e6284e9a upstream.

In cc_unmap_aead_request(), call dma_pool_free() for mlli buffer only
if an item is allocated from the pool and not always if there is a
pool allocated.
This fixes a kernel panic when trying to free a non-allocated item.

Cc: stable@vger.kernel.org
Signed-off-by: Hadar Gat &lt;hadar.gat@arm.com&gt;
Signed-off-by: Gilad Ben-Yossef &lt;gilad@benyossef.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>crypto: caam - fix DMA mapping of stack memory</title>
<updated>2019-03-23T19:09:40+00:00</updated>
<author>
<name>Horia Geantă</name>
<email>horia.geanta@nxp.com</email>
</author>
<published>2019-01-26T18:02:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6f4c11b09770e06781acee7873fe24c345c38a2e'/>
<id>urn:sha1:6f4c11b09770e06781acee7873fe24c345c38a2e</id>
<content type='text'>
commit c19650d6ea99bcd903d3e55dd61860026c701339 upstream.

Roland reports the following issue and provides a root cause analysis:

"On a v4.19 i.MX6 system with IMA and CONFIG_DMA_API_DEBUG enabled, a
warning is generated when accessing files on a filesystem for which IMA
measurement is enabled:

    ------------[ cut here ]------------
    WARNING: CPU: 0 PID: 1 at kernel/dma/debug.c:1181 check_for_stack.part.9+0xd0/0x120
    caam_jr 2101000.jr0: DMA-API: device driver maps memory from stack [addr=b668049e]
    Modules linked in:
    CPU: 0 PID: 1 Comm: switch_root Not tainted 4.19.0-20181214-1 #2
    Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
    Backtrace:
    [&lt;c010efb8&gt;] (dump_backtrace) from [&lt;c010f2d0&gt;] (show_stack+0x20/0x24)
    [&lt;c010f2b0&gt;] (show_stack) from [&lt;c08b04f4&gt;] (dump_stack+0xa0/0xcc)
    [&lt;c08b0454&gt;] (dump_stack) from [&lt;c012b610&gt;] (__warn+0xf0/0x108)
    [&lt;c012b520&gt;] (__warn) from [&lt;c012b680&gt;] (warn_slowpath_fmt+0x58/0x74)
    [&lt;c012b62c&gt;] (warn_slowpath_fmt) from [&lt;c0199acc&gt;] (check_for_stack.part.9+0xd0/0x120)
    [&lt;c01999fc&gt;] (check_for_stack.part.9) from [&lt;c019a040&gt;] (debug_dma_map_page+0x144/0x174)
    [&lt;c0199efc&gt;] (debug_dma_map_page) from [&lt;c065f7f4&gt;] (ahash_final_ctx+0x5b4/0xcf0)
    [&lt;c065f240&gt;] (ahash_final_ctx) from [&lt;c065b3c4&gt;] (ahash_final+0x1c/0x20)
    [&lt;c065b3a8&gt;] (ahash_final) from [&lt;c03fe278&gt;] (crypto_ahash_op+0x38/0x80)
    [&lt;c03fe240&gt;] (crypto_ahash_op) from [&lt;c03fe2e0&gt;] (crypto_ahash_final+0x20/0x24)
    [&lt;c03fe2c0&gt;] (crypto_ahash_final) from [&lt;c03f19a8&gt;] (ima_calc_file_hash+0x29c/0xa40)
    [&lt;c03f170c&gt;] (ima_calc_file_hash) from [&lt;c03f2b24&gt;] (ima_collect_measurement+0x1dc/0x240)
    [&lt;c03f2948&gt;] (ima_collect_measurement) from [&lt;c03f0a60&gt;] (process_measurement+0x4c4/0x6b8)
    [&lt;c03f059c&gt;] (process_measurement) from [&lt;c03f0cdc&gt;] (ima_file_check+0x88/0xa4)
    [&lt;c03f0c54&gt;] (ima_file_check) from [&lt;c02d8adc&gt;] (path_openat+0x5d8/0x1364)
    [&lt;c02d8504&gt;] (path_openat) from [&lt;c02dad24&gt;] (do_filp_open+0x84/0xf0)
    [&lt;c02daca0&gt;] (do_filp_open) from [&lt;c02cf50c&gt;] (do_open_execat+0x84/0x1b0)
    [&lt;c02cf488&gt;] (do_open_execat) from [&lt;c02d1058&gt;] (__do_execve_file+0x43c/0x890)
    [&lt;c02d0c1c&gt;] (__do_execve_file) from [&lt;c02d1770&gt;] (sys_execve+0x44/0x4c)
    [&lt;c02d172c&gt;] (sys_execve) from [&lt;c0101000&gt;] (ret_fast_syscall+0x0/0x28)
    ---[ end trace 3455789a10e3aefd ]---

The cause is that the struct ahash_request *req is created as a
stack-local variable up in the stack (presumably somewhere in the IMA
implementation), then passed down into the CAAM driver, which tries to
dma_single_map the req-&gt;result (indirectly via map_seq_out_ptr_result)
in order to make that buffer available for the CAAM to store the result
of the following hash operation.

The calling code doesn't know how req will be used by the CAAM driver,
and there could be other such occurrences where stack memory is passed
down to the CAAM driver. Therefore we should rather fix this issue in
the CAAM driver where the requirements are known."

Fix this problem by:
-instructing the crypto engine to write the final hash in state-&gt;caam_ctx
-subsequently memcpy-ing the final hash into req-&gt;result

Cc: &lt;stable@vger.kernel.org&gt; # v4.19+
Reported-by: Roland Hieber &lt;rhi@pengutronix.de&gt;
Signed-off-by: Horia Geantă &lt;horia.geanta@nxp.com&gt;
Tested-by: Roland Hieber &lt;rhi@pengutronix.de&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>crypto: caam - fixed handling of sg list</title>
<updated>2019-03-23T19:09:40+00:00</updated>
<author>
<name>Pankaj Gupta</name>
<email>pankaj.gupta@nxp.com</email>
</author>
<published>2019-02-01T07:18:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=74fd74e1fc8dc6cbbafcf274755d71dae640c823'/>
<id>urn:sha1:74fd74e1fc8dc6cbbafcf274755d71dae640c823</id>
<content type='text'>
commit 42e95d1f10dcf8b18b1d7f52f7068985b3dc5b79 upstream.

when the source sg contains more than 1 fragment and
destination sg contains 1 fragment, the caam driver
mishandle the buffers to be sent to caam.

Fixes: f2147b88b2b1 ("crypto: caam - Convert GCM to new AEAD interface")
Cc: &lt;stable@vger.kernel.org&gt; # 4.2+
Signed-off-by: Pankaj Gupta &lt;pankaj.gupta@nxp.com&gt;
Signed-off-by: Arun Pathak &lt;arun.pathak@nxp.com&gt;
Reviewed-by: Horia Geanta &lt;horia.geanta@nxp.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
</feed>
