linux/crypto
Douya Le 8eceab19eb crypto: af_alg - limit RX SG extraction by receive buffer budget
Make af_alg_get_rsgl() limit each RX scatterlist extraction to the
remaining receive buffer budget.

af_alg_get_rsgl() currently uses af_alg_readable() only as a gate
before extracting data into the RX scatterlist. Limit each extraction
to the remaining af_alg_rcvbuf(sk) budget so that receive-side
accounting matches the amount of data attached to the request.

If skcipher cannot obtain enough RX space for at least one chunk while
more data remains to be processed, reject the recvmsg call instead of
rounding the request length down to zero.

Fixes: e870456d8e ("crypto: algif_skcipher - overhaul memory management")
Reported-by: Yifan Wu <yifanwucs@gmail.com>
Reported-by: Juefei Pu <tomapufckgml@gmail.com>
Co-developed-by: Yuan Tan <yuantan098@gmail.com>
Signed-off-by: Yuan Tan <yuantan098@gmail.com>
Suggested-by: Xin Liu <bird@lzu.edu.cn>
Signed-off-by: Douya Le <ldy3087146292@gmail.com>
Signed-off-by: Ren Wei <n05ec@lzu.edu.cn>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-04-03 08:54:14 +08:00
..
asymmetric_keys x509: select CONFIG_CRYPTO_LIB_SHA256 2026-02-22 12:09:23 -08:00
async_tx
krb5 kernel.h: drop hex.h and update all hex.h users 2026-01-20 19:44:19 -08:00
842.c
Kconfig keys: Support for ML-DSA module signing 2026-02-10 09:32:30 -08:00
Makefile Locking updates for v6.20: 2026-02-10 12:28:44 -08:00
acompress.c Locking updates for v6.20: 2026-02-10 12:28:44 -08:00
adiantum.c crypto: adiantum - Drop support for asynchronous xchacha ciphers 2026-01-12 11:07:50 -08:00
aead.c crypto: api - remove unnecessary forward declarations 2026-01-23 13:48:43 +08:00
aegis-neon.h
aegis.h crypto: aegis - Switch from crypto_ft_tab[] to aes_enc_tab[] 2026-01-12 11:39:58 -08:00
aegis128-core.c
aegis128-neon-inner.c
aegis128-neon.c crypto: aegis128-neon - Move to more abstract 'ksimd' guard API 2025-11-12 09:52:01 +01:00
aes.c crypto: aes - Replace aes-generic with wrapper around lib 2026-01-12 11:39:58 -08:00
af_alg.c crypto: af_alg - limit RX SG extraction by receive buffer budget 2026-04-03 08:54:14 +08:00
ahash.c crypto: api - remove unnecessary forward declarations 2026-01-23 13:48:43 +08:00
akcipher.c crypto: api - remove unnecessary forward declarations 2026-01-23 13:48:43 +08:00
algapi.c Locking updates for v6.20: 2026-02-10 12:28:44 -08:00
algboss.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
algif_aead.c crypto: algif_aead - Revert to operating out-of-place 2026-03-31 17:11:47 +09:00
algif_hash.c crypto: af_alg - zero initialize memory allocated via sock_kmalloc 2025-10-17 16:03:57 +08:00
algif_rng.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
algif_skcipher.c crypto: af_alg - limit RX SG extraction by receive buffer budget 2026-04-03 08:54:14 +08:00
anubis.c crypto: anubis - simplify return statement in anubis_mod_init 2025-09-20 20:21:04 +08:00
api.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
arc4.c
aria_generic.c
authenc.c crypto: authenc - Correctly pass EINPROGRESS back up to the caller 2025-10-17 16:03:58 +08:00
authencesn.c crypto: authencesn - Do not place hiseq at end of dst for out-of-place decryption 2026-03-31 17:11:48 +09:00
blake2b.c crypto: blake2b - Reimplement using library API 2025-10-29 22:04:24 -07:00
blowfish_common.c crypto: blowfish - fix typo in comment 2026-01-23 13:48:44 +08:00
blowfish_generic.c
bpf_crypto_skcipher.c
camellia_generic.c
cast5_generic.c
cast6_generic.c
cast_common.c
cbc.c
ccm.c
chacha.c
chacha20poly1305.c
cipher.c
cmac.c
compress.h
crc32.c
crc32c.c
cryptd.c
crypto_engine.c Locking updates for v6.20: 2026-02-10 12:28:44 -08:00
crypto_null.c
crypto_user.c crypto: aes - Replace aes-generic with wrapper around lib 2026-01-12 11:39:58 -08:00
ctr.c
cts.c
deflate.c crypto: deflate - fix spurious -ENOSPC 2026-03-26 18:10:58 +09:00
des_generic.c
df_sp80090a.c crypto: drbg - Use new AES library API 2026-01-15 14:09:08 -08:00
dh.c
dh_helper.c
drbg.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
ecb.c
ecc.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
ecc_curve_defs.h
ecdh.c
ecdh_helper.c
ecdsa-p1363.c
ecdsa-x962.c
ecdsa.c
ecdsasignature.asn1
echainiv.c
ecrdsa.c
ecrdsa_defs.h
ecrdsa_params.asn1
ecrdsa_pub_key.asn1
essiv.c crypto: essiv - Check ssize for decryption and in-place encryption 2025-10-09 15:02:35 +08:00
fcrypt.c
fips.c crypto: fips - annotate fips_enable() with __init to free init memory after boot 2025-12-19 14:47:47 +08:00
gcm.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
geniv.c
ghash-generic.c
hash.h
hctr2.c crypto: hctr2 - Convert to use POLYVAL library 2025-11-11 11:03:38 -08:00
hkdf.c
hmac.c
internal.h crypto: Enable context analysis 2026-01-05 16:43:36 +01:00
jitterentropy-kcapi.c crypto: jitterentropy - Use default sha3 implementation 2025-11-05 20:30:51 -08:00
jitterentropy-testing.c
jitterentropy.c
jitterentropy.h
kdf_sp800108.c
khazad.c crypto: khazad - simplify return statement in khazad_mod_init 2025-12-29 08:48:35 +08:00
kpp.c crypto: api - remove unnecessary forward declarations 2026-01-23 13:48:43 +08:00
krb5enc.c
lrw.c
lskcipher.c crypto: lskcipher - Use unregister_lskciphers in register_lskciphers 2026-01-23 13:48:42 +08:00
lz4.c
lz4hc.c
lzo-rle.c
lzo.c
md4.c
md5.c
michael_mic.c
mldsa.c crypto: Add ML-DSA crypto_sig support 2026-01-21 22:32:50 +00:00
pcbc.c
pcrypt.c
proc.c crypto: Enable context analysis 2026-01-05 16:43:36 +01:00
ripemd.h
rmd160.c
rng.c crypto: rng - Use unregister_rngs in register_rngs 2026-02-06 18:52:22 +08:00
rsa-pkcs1pad.c
rsa.c
rsa_helper.c
rsaprivkey.asn1
rsapubkey.asn1
rsassa-pkcs1.c
scatterwalk.c Revert "crypto: scatterwalk - Move skcipher walk and use it for memcpy_sglist" 2025-11-22 10:04:50 +08:00
scompress.c Locking updates for v6.20: 2026-02-10 12:28:44 -08:00
seed.c
seqiv.c crypto: seqiv - Do not use req->iv after crypto_aead_encrypt 2025-12-19 14:47:06 +08:00
serpent_generic.c
sha1.c
sha3.c crypto: sha3 - Reimplement using library API 2025-11-05 20:30:51 -08:00
sha256.c
sha512.c
shash.c crypto: api - remove unnecessary forward declarations 2026-01-23 13:48:43 +08:00
sig.c
simd.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
skcipher.c crypto: api - remove unnecessary forward declarations 2026-01-23 13:48:43 +08:00
skcipher.h
sm3_generic.c
sm4.c
sm4_generic.c
streebog_generic.c
tcrypt.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
tcrypt.h crypto: tcrypt - Remove unused poly1305 support 2025-11-22 10:04:50 +08:00
tea.c
testmgr.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
testmgr.h This update includes the following changes: 2026-02-10 08:36:42 -08:00
twofish_common.c
twofish_generic.c
wp512.c
xcbc.c
xctr.c
xor.c
xts.c
xxhash_generic.c
zstd.c Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00