[PATCH] crypto: qat - Remove redundant nrbg rings

2016-03-22 Thread Tadeusz Struk
From: Ahsan Atta Remove redundant nrbg rings. Signed-off-by: Ahsan Atta Signed-off-by: Tadeusz Struk --- drivers/crypto/qat/qat_common/adf_cfg_strings.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/crypto/qat/qat_common/adf_cfg_strings.h b/drivers/crypto/qat/qat_common/adf_cf

[PATCH] crypto: qat - make sure const_tab is 1024 bytes aligned

2016-03-22 Thread Tadeusz Struk
FW requires the const_tab to be 1024 bytes aligned. Signed-off-by: Tadeusz Struk --- drivers/crypto/qat/qat_common/adf_admin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/qat/qat_common/adf_admin.c b/drivers/crypto/qat/qat_common/adf_admin.c index eb557f6.

Re: [PATCH] crypto: sun4i-ss: use spin_lock_irq{save|restore}

2016-03-22 Thread Corentin LABBE
Le 22/03/2016 17:04, LABBE Corentin a écrit : > The current sun4i-ss driver is subject to data corruption when > ciphering/deciphering. > It occurs randomly on end of handled data. > No root cause have been found and the only way to remove it is to replace > all spin_lock_bh by they irq counterpart

[PATCH] crypto: sun4i-ss: use spin_lock_irq{save|restore}

2016-03-22 Thread LABBE Corentin
The current sun4i-ss driver is subject to data corruption when ciphering/deciphering. It occurs randomly on end of handled data. No root cause have been found and the only way to remove it is to replace all spin_lock_bh by they irq counterparts. Signed-off-by: LABBE Corentin Cc: stable --- driv

Re: [PATCH RESEND v2 00/14] lib/mpi: bug fixes and cleanup

2016-03-22 Thread Tadeusz Struk
On 03/22/2016 12:06 AM, Nicolai Stange wrote: > Ugh. I'll send a v3 fixing this up during the course of the day. Or do > you prefer to apply your incremental patch below to this v2 as it > stands? Either way is fine with me. Thanks, -- TS -- To unsubscribe from this list: send the line "unsubscri

[PATCH v3 14/14] lib/mpi: mpi_read_raw_from_sgl(): fix out-of-bounds buffer access

2016-03-22 Thread Nicolai Stange
Within the copying loop in mpi_read_raw_from_sgl(), the last input SGE's byte count gets artificially extended as follows: if (sg_is_last(sg) && (len % BYTES_PER_MPI_LIMB)) len += BYTES_PER_MPI_LIMB - (len % BYTES_PER_MPI_LIMB); Within the following byte copying loop, this causes reads beyo

[PATCH v3 13/14] lib/mpi: mpi_read_raw_from_sgl(): sanitize meaning of indices

2016-03-22 Thread Nicolai Stange
Within the byte reading loop in mpi_read_raw_sgl(), there are two housekeeping indices used, z and x. At all times, the index z represents the number of output bytes covered by the input SGEs for which processing has completed so far. This includes any leading zero bytes within the most significan

[PATCH v3 12/14] lib/mpi: mpi_read_raw_from_sgl(): fix nbits calculation

2016-03-22 Thread Nicolai Stange
The number of bits, nbits, is calculated in mpi_read_raw_from_sgl() as follows: nbits = nbytes * 8; Afterwards, the number of leading zero bits of the first byte get subtracted: nbits -= count_leading_zeros(*(u8 *)(sg_virt(sgl) + lzeros)); However, count_leading_zeros() takes an unsigned lo

[PATCH v3 05/14] lib/mpi: mpi_write_sgl(): replace open coded endian conversion

2016-03-22 Thread Nicolai Stange
Currently, the endian conversion from CPU order to BE is open coded in mpi_write_sgl(). Replace this by the centrally provided cpu_to_be*() macros. Signed-off-by: Nicolai Stange --- lib/mpi/mpicoder.c | 27 +++ 1 file changed, 11 insertions(+), 16 deletions(-) diff --gi

[PATCH v3 09/14] lib/mpi: mpi_read_raw_from_sgl(): replace len argument by nbytes

2016-03-22 Thread Nicolai Stange
Currently, the nbytes local variable is calculated from the len argument as follows: ... mpi_read_raw_from_sgl(..., unsigned int len) { unsigned nbytes; ... if (!ents) nbytes = 0; else nbytes = len - lzeros; ... } Given that nbytes is derived from len in a tr

[PATCH v3 08/14] lib/mpi: mpi_read_buffer(): fix buffer overflow

2016-03-22 Thread Nicolai Stange
Currently, mpi_read_buffer() writes full limbs to the output buffer and moves memory around to purge leading zero limbs afterwards. However, with commit 9cbe21d8f89d ("lib/mpi: only require buffers as big as needed for the integer") the caller is only required to provid

[PATCH v3 11/14] lib/mpi: mpi_read_raw_from_sgl(): purge redundant clearing of nbits

2016-03-22 Thread Nicolai Stange
In mpi_read_raw_from_sgl(), unsigned nbits is calculated as follows: nbits = nbytes * 8; and redundantly cleared later on if nbytes == 0: if (nbytes > 0) ... else nbits = 0; Purge this redundant clearing for the sake of clarity. Signed-off-by: Nicolai Stange --- lib/mpi/mpicode

[PATCH v3 10/14] lib/mpi: mpi_read_raw_from_sgl(): don't include leading zero SGEs in nbytes

2016-03-22 Thread Nicolai Stange
At the very beginning of mpi_read_raw_from_sgl(), the leading zeros of the input scatterlist are counted: lzeros = 0; for_each_sg(sgl, sg, ents, i) { ... if (/* sg contains nonzero bytes */) break; /* sg contains nothing but zeros here */ ents--; lzeros = 0; } Lat

[PATCH v3 07/14] lib/mpi: mpi_read_buffer(): replace open coded endian conversion

2016-03-22 Thread Nicolai Stange
Currently, the endian conversion from CPU order to BE is open coded in mpi_read_buffer(). Replace this by the centrally provided cpu_to_be*() macros. Copy from the temporary storage on stack to the destination buffer by means of memcpy(). Signed-off-by: Nicolai Stange --- lib/mpi/mpicoder.c | 2

[PATCH v3 06/14] lib/mpi: mpi_read_buffer(): optimize skipping of leading zero limbs

2016-03-22 Thread Nicolai Stange
Currently, if the number of leading zeros is greater than fits into a complete limb, mpi_read_buffer() skips them by iterating over them limb-wise. Instead of skipping the high order zero limbs within the loop as shown above, adjust the copying loop's bounds. Signed-off-by: Nicolai Stange --- l

[PATCH v3 04/14] lib/mpi: mpi_write_sgl(): fix out-of-bounds stack access

2016-03-22 Thread Nicolai Stange
Within the copying loop in mpi_write_sgl(), we have if (lzeros) { mpi_limb_t *limb1 = (void *)p - sizeof(alimb); mpi_limb_t *limb2 = (void *)p - sizeof(alimb) + lzeros; *limb1 = *limb2; ... } where p points past the end of alimb2 which lives on t

[PATCH v3 03/14] lib/mpi: mpi_write_sgl(): purge redundant pointer arithmetic

2016-03-22 Thread Nicolai Stange
Within the copying loop in mpi_write_sgl(), we have if (lzeros) { ... p -= lzeros; y = lzeros; } p = p - (sizeof(alimb) - y); If lzeros == 0, then y == 0, too. Thus, lzeros gets subtracted and added back again to p. Purge this redundancy. Signed-off-by: Nicolai Stange --- li

[PATCH v3 02/14] lib/mpi: mpi_write_sgl(): fix style issue with lzero decrement

2016-03-22 Thread Nicolai Stange
Within the copying loop in mpi_write_sgl(), we have if (lzeros > 0) { ... lzeros -= sizeof(alimb); } However, at this point, lzeros < sizeof(alimb) holds. Make this fact explicit by rewriting the above to if (lzeros) { ... lzeros = 0; } Signed-off-by: Nicolai Stange ---

[PATCH v3 01/14] lib/mpi: mpi_write_sgl(): fix skipping of leading zero limbs

2016-03-22 Thread Nicolai Stange
Currently, if the number of leading zeros is greater than fits into a complete limb, mpi_write_sgl() skips them by iterating over them limb-wise. However, it fails to adjust its internal leading zeros tracking variable, lzeros, accordingly: it does a p -= sizeof(alimb); continue; which shoul

[PATCH v3 00/14] lib/mpi: bug fixes and cleanup

2016-03-22 Thread Nicolai Stange
that is [1-7,9-14/14], go unchanged and have got a Tested-by: Tadeusz Struk already. Applicable to linux-next-20160322. Changes to v2: - [8/14] ("lib/mpi: mpi_read_buffer(): fix buffer overflow") + Fix the pointer arithmetic issue found by Tadeusz Struk Changes to v1: - [

Re: [PATCH] vti6: Add pmtu handling to vti6_xmit.

2016-03-22 Thread Steffen Klassert
On Tue, Mar 15, 2016 at 01:28:01PM +0100, Steffen Klassert wrote: > On Mon, Mar 14, 2016 at 09:52:05PM +, Mark McKinstry wrote: > > Your patch adds a dst_release() call to my suggested fix, but this is > > problematic because the kfree_skb() call at tx_error already takes care > > of releasin

Re: [PATCH RESEND v2 00/14] lib/mpi: bug fixes and cleanup

2016-03-22 Thread Nicolai Stange
Hi Tadeusz, thank you very much for your quick reply! Tadeusz Struk writes: > On 03/21/2016 06:26 AM, Nicolai Stange wrote: >> This is a resend of v2 with the crypto people properly CC'd. >> >> The original v1 can be found here: >> >> >> http://lkml.kernel.org/g/1458237606-4954-1-git-send-