Skip to content

Commit 0473719

Browse files
committed
Merge tag 'v6.8-p3' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto fixes from Herbert Xu: "Fix regressions in cbc and algif_hash, as well as an older NULL-pointer dereference in ccp" * tag 'v6.8-p3' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: crypto: algif_hash - Remove bogus SGL free on zero-length error path crypto: cbc - Ensure statesize is zero crypto: ccp - Fix null pointer dereference in __sev_platform_shutdown_locked
2 parents 860d7dc + 24c890d commit 0473719

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

crypto/algif_hash.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,13 @@ static int hash_sendmsg(struct socket *sock, struct msghdr *msg,
9191
if (!(msg->msg_flags & MSG_MORE)) {
9292
err = hash_alloc_result(sk, ctx);
9393
if (err)
94-
goto unlock_free;
94+
goto unlock_free_result;
9595
ahash_request_set_crypt(&ctx->req, NULL,
9696
ctx->result, 0);
9797
err = crypto_wait_req(crypto_ahash_final(&ctx->req),
9898
&ctx->wait);
9999
if (err)
100-
goto unlock_free;
100+
goto unlock_free_result;
101101
}
102102
goto done_more;
103103
}
@@ -170,6 +170,7 @@ static int hash_sendmsg(struct socket *sock, struct msghdr *msg,
170170

171171
unlock_free:
172172
af_alg_free_sg(&ctx->sgl);
173+
unlock_free_result:
173174
hash_free_result(sk, ctx);
174175
ctx->more = false;
175176
goto unlock;

crypto/cbc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ static int crypto_cbc_create(struct crypto_template *tmpl, struct rtattr **tb)
148148
if (!is_power_of_2(inst->alg.co.base.cra_blocksize))
149149
goto out_free_inst;
150150

151+
if (inst->alg.co.statesize)
152+
goto out_free_inst;
153+
151154
inst->alg.encrypt = crypto_cbc_encrypt;
152155
inst->alg.decrypt = crypto_cbc_decrypt;
153156

drivers/crypto/ccp/sev-dev.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,10 +534,16 @@ EXPORT_SYMBOL_GPL(sev_platform_init);
534534

535535
static int __sev_platform_shutdown_locked(int *error)
536536
{
537-
struct sev_device *sev = psp_master->sev_data;
537+
struct psp_device *psp = psp_master;
538+
struct sev_device *sev;
538539
int ret;
539540

540-
if (!sev || sev->state == SEV_STATE_UNINIT)
541+
if (!psp || !psp->sev_data)
542+
return 0;
543+
544+
sev = psp->sev_data;
545+
546+
if (sev->state == SEV_STATE_UNINIT)
541547
return 0;
542548

543549
ret = __sev_do_cmd_locked(SEV_CMD_SHUTDOWN, NULL, error);

0 commit comments

Comments
 (0)