Commit a69eddfd authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull crypto fixes from Herbert Xu:

 - Fix UAF in seqiv

 - Fix regression in hisilicon

* tag 'v6.19-p2' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
  crypto: hisilicon/qm - fix incorrect judgment in qm_get_complete_eqe_num()
  crypto: seqiv - Do not use req->iv after crypto_aead_encrypt
parents f8f9c1f4 b74fd80d
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ static int seqiv_aead_encrypt(struct aead_request *req)
	struct aead_geniv_ctx *ctx = crypto_aead_ctx(geniv);
	struct aead_request *subreq = aead_request_ctx(req);
	crypto_completion_t compl;
	bool unaligned_info;
	void *data;
	u8 *info;
	unsigned int ivsize = 8;
@@ -68,8 +69,9 @@ static int seqiv_aead_encrypt(struct aead_request *req)
		memcpy_sglist(req->dst, req->src,
			      req->assoclen + req->cryptlen);

	if (unlikely(!IS_ALIGNED((unsigned long)info,
				 crypto_aead_alignmask(geniv) + 1))) {
	unaligned_info = !IS_ALIGNED((unsigned long)info,
				     crypto_aead_alignmask(geniv) + 1);
	if (unlikely(unaligned_info)) {
		info = kmemdup(req->iv, ivsize, req->base.flags &
			       CRYPTO_TFM_REQ_MAY_SLEEP ? GFP_KERNEL :
			       GFP_ATOMIC);
@@ -89,7 +91,7 @@ static int seqiv_aead_encrypt(struct aead_request *req)
	scatterwalk_map_and_copy(info, req->dst, req->assoclen, ivsize, 1);

	err = crypto_aead_encrypt(subreq);
	if (unlikely(info != req->iv))
	if (unlikely(unaligned_info))
		seqiv_aead_encrypt_complete2(req, err);
	return err;
}
+4 −5
Original line number Diff line number Diff line
@@ -991,7 +991,7 @@ static void qm_get_complete_eqe_num(struct hisi_qm *qm)
		return;
	poll_data = &qm->poll_data[cqn];

	while (QM_EQE_PHASE(dw0) != qm->status.eqc_phase) {
	do {
		poll_data->qp_finish_id[eqe_num] = dw0 & QM_EQE_CQN_MASK;
		eqe_num++;

@@ -1004,11 +1004,10 @@ static void qm_get_complete_eqe_num(struct hisi_qm *qm)
			qm->status.eq_head++;
		}

		if (eqe_num == (eq_depth >> 1) - 1)
			break;

		dw0 = le32_to_cpu(eqe->dw0);
	}
		if (QM_EQE_PHASE(dw0) != qm->status.eqc_phase)
			break;
	} while (eqe_num < (eq_depth >> 1) - 1);

	poll_data->eqe_num = eqe_num;
	queue_work(qm->wq, &poll_data->work);