This push fixes a couple of regressions in af_alg and incorrect
return values in crypto/asymmetric_keys/public_key. -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEn51F/lCuNhUwmDeSxycdCkmxi6cFAmSpW4oACgkQxycdCkmx i6fmnA/9FdX6jk25C/ebCCsjlnZk3IP99LCv8ZA3Zuas6xT6C7e5FzmAx9qBAxcE U4CaOBp0FPf36ebrEPkhWY2xBGFxgU18K/DSFqt6Rtki8ihoBMC/zUfJCh/B4QMM h8uJ7LKRYmDXoWdE2v6rNRM8etRd8KDLj+x3GIq0ryvoA4tICUXA87MBnssfv2+L 5phIfxtfRaZSbozdXxjXD+LYpDzKZSed5t+8+63v7W3Qu6LoJiapi/ZmpCnik8kg OxlLuUUuu0dLMZxeDRDfSjYCXYwdnkwluBBJtnOFHYYxOb1Vfbgi5iuL3d29HjPD CjUsIwxGYvzuCEDdvNE5QhfKidxjKAbLiIALzpwz4GIzXDVV7Hgljev8hD09gGP9 T/FscVNgUmZtgaORCnTQRM3ZYUfVTEgP51SnRZ/Pg/KleTojzkMd5mEmUVBN0dfw ytLdAvr7FiEgu1a/BG4EacRrZx+9Gf/K9mqpAq2BGbeb6OrkX0dHSeEq6ftgK5zB ACVm1hERTu2y7rTwypIFtuZSjrL9G5nj91c9wAmVt2lOysssp/JLQly1wQHAII9/ xsnSLO/VYt4uIlvGBPs6AxRcs+LbOcmOXK540BD1aPswtXRT42h2cH6LfCld5Nzo bT/5F2U4jCZTN+mNcfC+HUtnzjo2UeBu3jgndt6zs3a83UlqoIo= =oojR -----END PGP SIGNATURE----- Merge tag 'v6.5-p2' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 Pull crypto fixes from Herbert Xu: "Fix a couple of regressions in af_alg and incorrect return values in crypto/asymmetric_keys/public_key" * tag 'v6.5-p2' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: crypto: algif_hash - Fix race between MORE and non-MORE sends KEYS: asymmetric: Fix error codes crypto: af_alg - Fix merging of written data into spliced pages
This commit is contained in:
commit
419caed6cc
@ -992,7 +992,7 @@ int af_alg_sendmsg(struct socket *sock, struct msghdr *msg, size_t size,
|
||||
ssize_t plen;
|
||||
|
||||
/* use the existing memory in an allocated page */
|
||||
if (ctx->merge) {
|
||||
if (ctx->merge && !(msg->msg_flags & MSG_SPLICE_PAGES)) {
|
||||
sgl = list_entry(ctx->tsgl_list.prev,
|
||||
struct af_alg_tsgl, list);
|
||||
sg = sgl->sg + sgl->cur - 1;
|
||||
@ -1054,6 +1054,7 @@ int af_alg_sendmsg(struct socket *sock, struct msghdr *msg, size_t size,
|
||||
ctx->used += plen;
|
||||
copied += plen;
|
||||
size -= plen;
|
||||
ctx->merge = 0;
|
||||
} else {
|
||||
do {
|
||||
struct page *pg;
|
||||
@ -1085,12 +1086,12 @@ int af_alg_sendmsg(struct socket *sock, struct msghdr *msg, size_t size,
|
||||
size -= plen;
|
||||
sgl->cur++;
|
||||
} while (len && sgl->cur < MAX_SGL_ENTS);
|
||||
|
||||
ctx->merge = plen & (PAGE_SIZE - 1);
|
||||
}
|
||||
|
||||
if (!size)
|
||||
sg_mark_end(sg + sgl->cur - 1);
|
||||
|
||||
ctx->merge = plen & (PAGE_SIZE - 1);
|
||||
}
|
||||
|
||||
err = 0;
|
||||
|
@ -68,13 +68,15 @@ static int hash_sendmsg(struct socket *sock, struct msghdr *msg,
|
||||
struct hash_ctx *ctx = ask->private;
|
||||
ssize_t copied = 0;
|
||||
size_t len, max_pages, npages;
|
||||
bool continuing = ctx->more, need_init = false;
|
||||
bool continuing, need_init = false;
|
||||
int err;
|
||||
|
||||
max_pages = min_t(size_t, ALG_MAX_PAGES,
|
||||
DIV_ROUND_UP(sk->sk_sndbuf, PAGE_SIZE));
|
||||
|
||||
lock_sock(sk);
|
||||
continuing = ctx->more;
|
||||
|
||||
if (!continuing) {
|
||||
/* Discard a previous request that wasn't marked MSG_MORE. */
|
||||
hash_free_result(sk, ctx);
|
||||
|
@ -185,8 +185,10 @@ static int software_key_query(const struct kernel_pkey_params *params,
|
||||
|
||||
if (issig) {
|
||||
sig = crypto_alloc_sig(alg_name, 0, 0);
|
||||
if (IS_ERR(sig))
|
||||
if (IS_ERR(sig)) {
|
||||
ret = PTR_ERR(sig);
|
||||
goto error_free_key;
|
||||
}
|
||||
|
||||
if (pkey->key_is_private)
|
||||
ret = crypto_sig_set_privkey(sig, key, pkey->keylen);
|
||||
@ -208,8 +210,10 @@ static int software_key_query(const struct kernel_pkey_params *params,
|
||||
}
|
||||
} else {
|
||||
tfm = crypto_alloc_akcipher(alg_name, 0, 0);
|
||||
if (IS_ERR(tfm))
|
||||
if (IS_ERR(tfm)) {
|
||||
ret = PTR_ERR(tfm);
|
||||
goto error_free_key;
|
||||
}
|
||||
|
||||
if (pkey->key_is_private)
|
||||
ret = crypto_akcipher_set_priv_key(tfm, key, pkey->keylen);
|
||||
@ -300,8 +304,10 @@ static int software_key_eds_op(struct kernel_pkey_params *params,
|
||||
|
||||
if (issig) {
|
||||
sig = crypto_alloc_sig(alg_name, 0, 0);
|
||||
if (IS_ERR(sig))
|
||||
if (IS_ERR(sig)) {
|
||||
ret = PTR_ERR(sig);
|
||||
goto error_free_key;
|
||||
}
|
||||
|
||||
if (pkey->key_is_private)
|
||||
ret = crypto_sig_set_privkey(sig, key, pkey->keylen);
|
||||
@ -313,8 +319,10 @@ static int software_key_eds_op(struct kernel_pkey_params *params,
|
||||
ksz = crypto_sig_maxsize(sig);
|
||||
} else {
|
||||
tfm = crypto_alloc_akcipher(alg_name, 0, 0);
|
||||
if (IS_ERR(tfm))
|
||||
if (IS_ERR(tfm)) {
|
||||
ret = PTR_ERR(tfm);
|
||||
goto error_free_key;
|
||||
}
|
||||
|
||||
if (pkey->key_is_private)
|
||||
ret = crypto_akcipher_set_priv_key(tfm, key, pkey->keylen);
|
||||
@ -411,8 +419,10 @@ int public_key_verify_signature(const struct public_key *pkey,
|
||||
|
||||
key = kmalloc(pkey->keylen + sizeof(u32) * 2 + pkey->paramlen,
|
||||
GFP_KERNEL);
|
||||
if (!key)
|
||||
if (!key) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_tfm;
|
||||
}
|
||||
|
||||
memcpy(key, pkey->key, pkey->keylen);
|
||||
ptr = key + pkey->keylen;
|
||||
|
Loading…
x
Reference in New Issue
Block a user