<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/crypto/qat, branch linux-6.3.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.3.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.3.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2023-07-11T17:39:50Z</updated>
<entry>
<title>crypto: qat - unmap buffers before free for RSA</title>
<updated>2023-07-11T17:39:50Z</updated>
<author>
<name>Hareshx Sankar Raj</name>
</author>
<published>2023-06-05T21:06:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3b12fe09308aece799ace85e30ae8a5d194dcc2e'/>
<id>urn:sha1:3b12fe09308aece799ace85e30ae8a5d194dcc2e</id>
<content type='text'>
[ Upstream commit d776b25495f2c71b9dbf1f5e53b642215ba72f3c ]

The callback function for RSA frees the memory allocated for the source
and destination buffers before unmapping them.
This sequence is wrong.

Change the cleanup sequence to unmap the buffers before freeing them.

Fixes: 3dfaf0071ed7 ("crypto: qat - remove dma_free_coherent() for RSA")
Signed-off-by: Hareshx Sankar Raj &lt;hareshx.sankar.raj@intel.com&gt;
Co-developed-by: Bolemx Sivanagaleela &lt;bolemx.sivanagaleela@intel.com&gt;
Signed-off-by: Bolemx Sivanagaleela &lt;bolemx.sivanagaleela@intel.com&gt;
Reviewed-by: Giovanni Cabiddu &lt;giovanni.cabiddu@intel.com&gt;
Reviewed-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Signed-off-by: Giovanni Cabiddu &lt;giovanni.cabiddu@intel.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: qat - unmap buffer before free for DH</title>
<updated>2023-07-11T17:39:50Z</updated>
<author>
<name>Hareshx Sankar Raj</name>
</author>
<published>2023-06-05T21:06:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=95d22e976210ded409b1a232b1901b68b12f9716'/>
<id>urn:sha1:95d22e976210ded409b1a232b1901b68b12f9716</id>
<content type='text'>
[ Upstream commit eb7713f5ca97697b92f225127440d1525119b8de ]

The callback function for DH frees the memory allocated for the
destination buffer before unmapping it.
This sequence is wrong.

Change the cleanup sequence to unmap the buffer before freeing it.

Fixes: 029aa4624a7f ("crypto: qat - remove dma_free_coherent() for DH")
Signed-off-by: Hareshx Sankar Raj &lt;hareshx.sankar.raj@intel.com&gt;
Co-developed-by: Bolemx Sivanagaleela &lt;bolemx.sivanagaleela@intel.com&gt;
Signed-off-by: Bolemx Sivanagaleela &lt;bolemx.sivanagaleela@intel.com&gt;
Reviewed-by: Giovanni Cabiddu &lt;giovanni.cabiddu@intel.com&gt;
Reviewed-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Signed-off-by: Giovanni Cabiddu &lt;giovanni.cabiddu@intel.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: qat - fix concurrency issue when device state changes</title>
<updated>2023-05-11T14:17:12Z</updated>
<author>
<name>Shashank Gupta</name>
</author>
<published>2023-02-27T20:55:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=114dfdda3cf405bbcf40f59063c079552f37be3d'/>
<id>urn:sha1:114dfdda3cf405bbcf40f59063c079552f37be3d</id>
<content type='text'>
[ Upstream commit 1bdc85550a2b59bb7f62ead7173134e66dd2d60e ]

The sysfs `state` attribute is not protected against race conditions.
If multiple processes perform a device state transition on the same
device in parallel, unexpected behaviors might occur.

For transitioning the device state, adf_sysfs.c calls the functions
adf_dev_init(), adf_dev_start(), adf_dev_stop() and adf_dev_shutdown()
which are unprotected and interdependent on each other. To perform a
state transition, these functions needs to be called in a specific
order:
  * device up:   adf_dev_init() -&gt; adf_dev_start()
  * device down: adf_dev_stop() -&gt; adf_dev_shutdown()

This change introduces the functions adf_dev_up() and adf_dev_down()
which wrap the state machine functions and protect them with a
per-device lock. These are then used in adf_sysfs.c instead of the
individual state transition functions.

Fixes: 5ee52118ac14 ("crypto: qat - expose device state through sysfs for 4xxx")
Signed-off-by: Shashank Gupta &lt;shashank.gupta@intel.com&gt;
Reviewed-by: Giovanni Cabiddu &lt;giovanni.cabiddu@intel.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: qat - Use request_complete helpers</title>
<updated>2023-02-13T10:35:14Z</updated>
<author>
<name>Herbert Xu</name>
</author>
<published>2023-01-31T08:02:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6c621864554c9b767df6839999d5e0465c8be097'/>
<id>urn:sha1:6c621864554c9b767df6839999d5e0465c8be097</id>
<content type='text'>
Use the request_complete helpers instead of calling the completion
function directly.

Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Reviewed-by: Giovanni Cabiddu &lt;giovanni.cabiddu@intel.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: qat - drop log level of msg in get_instance_node()</title>
<updated>2023-02-10T09:20:19Z</updated>
<author>
<name>Giovanni Cabiddu</name>
</author>
<published>2023-02-01T17:04:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0ceb587dbb94e13bb70988872f1fc0cf412f5f87'/>
<id>urn:sha1:0ceb587dbb94e13bb70988872f1fc0cf412f5f87</id>
<content type='text'>
The functions qat_crypto_get_instance_node() and
qat_compression_get_instance_node() allow to get a QAT instance (ring
pair) on a device close to the node specified as input parameter.
When this is not possible, and a QAT device is available in the system,
these function return an instance on a remote node and they print a
message reporting that it is not possible to find a device on the specified
node. This is interpreted by people as an error rather than an info.

The print "Could not find a device on node" indicates that a kernel
application is running on a core in a socket that does not have a QAT
device directly attached to it and performance might suffer.

Due to the nature of the message, this can be considered as a debug
message, therefore drop the severity to debug and report it only once
to avoid flooding.

Suggested-by: Vladis Dronov &lt;vdronov@redhat.com&gt;
Signed-off-by: Giovanni Cabiddu &lt;giovanni.cabiddu@intel.com&gt;
Reviewed-by: Fiona Trahe &lt;fiona.trahe@intel.com&gt;
Reviewed-by: Vladis Dronov &lt;vdronov@redhat.com&gt;
Tested-by: Vladis Dronov &lt;vdronov@redhat.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: qat - fix out-of-bounds read</title>
<updated>2023-02-10T09:20:19Z</updated>
<author>
<name>Giovanni Cabiddu</name>
</author>
<published>2023-02-01T15:59:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f6044cc3030e139f60c281386f28bda6e3049d66'/>
<id>urn:sha1:f6044cc3030e139f60c281386f28bda6e3049d66</id>
<content type='text'>
When preparing an AER-CTR request, the driver copies the key provided by
the user into a data structure that is accessible by the firmware.
If the target device is QAT GEN4, the key size is rounded up by 16 since
a rounded up size is expected by the device.
If the key size is rounded up before the copy, the size used for copying
the key might be bigger than the size of the region containing the key,
causing an out-of-bounds read.

Fix by doing the copy first and then update the keylen.

This is to fix the following warning reported by KASAN:

	[  138.150574] BUG: KASAN: global-out-of-bounds in qat_alg_skcipher_init_com.isra.0+0x197/0x250 [intel_qat]
	[  138.150641] Read of size 32 at addr ffffffff88c402c0 by task cryptomgr_test/2340

	[  138.150651] CPU: 15 PID: 2340 Comm: cryptomgr_test Not tainted 6.2.0-rc1+ #45
	[  138.150659] Hardware name: Intel Corporation ArcherCity/ArcherCity, BIOS EGSDCRB1.86B.0087.D13.2208261706 08/26/2022
	[  138.150663] Call Trace:
	[  138.150668]  &lt;TASK&gt;
	[  138.150922]  kasan_check_range+0x13a/0x1c0
	[  138.150931]  memcpy+0x1f/0x60
	[  138.150940]  qat_alg_skcipher_init_com.isra.0+0x197/0x250 [intel_qat]
	[  138.151006]  qat_alg_skcipher_init_sessions+0xc1/0x240 [intel_qat]
	[  138.151073]  crypto_skcipher_setkey+0x82/0x160
	[  138.151085]  ? prepare_keybuf+0xa2/0xd0
	[  138.151095]  test_skcipher_vec_cfg+0x2b8/0x800

Fixes: 67916c951689 ("crypto: qat - add AES-CTR support for QAT GEN4 devices")
Cc: &lt;stable@vger.kernel.org&gt;
Reported-by: Vladis Dronov &lt;vdronov@redhat.com&gt;
Signed-off-by: Giovanni Cabiddu &lt;giovanni.cabiddu@intel.com&gt;
Reviewed-by: Fiona Trahe &lt;fiona.trahe@intel.com&gt;
Reviewed-by: Vladis Dronov &lt;vdronov@redhat.com&gt;
Tested-by: Vladis Dronov &lt;vdronov@redhat.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: qat - add qat_zlib_deflate</title>
<updated>2023-02-03T04:54:54Z</updated>
<author>
<name>Lucas Segarra Fernandez</name>
</author>
<published>2023-01-23T10:42:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7ce515e636ec1807723c30fd3a6181b4ccac6ec6'/>
<id>urn:sha1:7ce515e636ec1807723c30fd3a6181b4ccac6ec6</id>
<content type='text'>
The ZLIB format (RFC 1950) is made of deflate compressed data surrounded
by a header and a footer. The QAT accelerators support only the deflate
algorithm, therefore the header and the footer need to be inserted in
software.

This adds logic in the QAT driver to support the ZLIB format. In
particular:
  * Generalize the function qat_comp_alg_compress_decompress() to allow
    skipping an initial region (header) of the source and/or destination
    scatter lists.
  * Add logic to register the qat_zlib_deflate algorithm into the acomp
    framework.
  * For ZLIB compression, skip the initial portion of the destination
    buffer before sending the job to the QAT accelerator and insert the
    ZLIB header and footer in the callback, after the QAT request has
    been processed.
  * For ZLIB decompression, parse the header in the input buffer
    provided by the user and verify its validity before attempting the
    decompression of the buffer with QAT. Then submit the buffer to QAT
    for decompression. In the callback verify the correctness of the
    footer by comparing the value of the ADLER produced by QAT with the
    one in the destination buffer.

Signed-off-by: Lucas Segarra Fernandez &lt;lucas.segarra.fernandez@intel.com&gt;
Reviewed-by: Giovanni Cabiddu &lt;giovanni.cabiddu@intel.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: qat - extend buffer list logic interface</title>
<updated>2023-02-03T04:54:54Z</updated>
<author>
<name>Lucas Segarra Fernandez</name>
</author>
<published>2023-01-23T10:42:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c1e98807b7049dfc04a971b937ca127faa5514f4'/>
<id>urn:sha1:c1e98807b7049dfc04a971b937ca127faa5514f4</id>
<content type='text'>
Extend qat_bl_sgl_to_bufl() to allow skipping the mapping of a region
of the source and the destination scatter lists starting from byte
zero.

This is to support the ZLIB format (RFC 1950) in the qat driver.
The ZLIB format is made of deflate compressed data surrounded by a
header and a footer. The QAT accelerators support only the deflate
algorithm, therefore the header should not be mapped since it is
inserted in software.

Signed-off-by: Lucas Segarra Fernandez &lt;lucas.segarra.fernandez@intel.com&gt;
Reviewed-by: Giovanni Cabiddu &lt;giovanni.cabiddu@intel.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: qat - fix spelling mistakes from 'bufer' to 'buffer'</title>
<updated>2023-01-20T10:29:31Z</updated>
<author>
<name>Meadhbh Fitzpatrick</name>
</author>
<published>2023-01-12T14:51:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=692ed5d4b270d1b12aa7f00f25f4f1e914831cb3'/>
<id>urn:sha1:692ed5d4b270d1b12aa7f00f25f4f1e914831cb3</id>
<content type='text'>
Fix spelling mistakes from 'bufer' to 'buffer' in qat_common.
Also fix indentation issue caused by the spelling change.

Signed-off-by: Meadhbh Fitzpatrick &lt;meadhbh.fitzpatrick@intel.com&gt;
Reviewed-by: Ilpo Järvinen &lt;ilpo.jarvinen@linux.intel.com&gt;
Reviewed-by: Giovanni Cabiddu &lt;giovanni.cabiddu@intel.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: qat - add resubmit logic for decompression</title>
<updated>2022-12-09T10:45:00Z</updated>
<author>
<name>Giovanni Cabiddu</name>
</author>
<published>2022-11-28T12:21:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3112d0f1b0b32daac97d170dbc9d3cce69f7ff49'/>
<id>urn:sha1:3112d0f1b0b32daac97d170dbc9d3cce69f7ff49</id>
<content type='text'>
The acomp API allows to send requests with a NULL destination buffer. In
this case, the algorithm implementation needs to allocate the
destination scatter list, perform the operation and return the buffer to
the user. For decompression, data is likely to expand and be bigger than
the allocated buffer.

This implements a re-submission mechanism for decompression requests
that is triggered if the destination buffer, allocated by the driver,
is not sufficiently big to store the output from decompression.

If an overflow is detected when processing the callback for a
decompression request with a NULL destination buffer, a workqueue is
scheduled. This allocates a new scatter list of size CRYPTO_ACOMP_DST_MAX,
now 128KB, creates a new firmware scatter list and resubmits the job to
the hardware accelerator.

Suggested-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Giovanni Cabiddu &lt;giovanni.cabiddu@intel.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
</feed>
