Commit 0efae411 authored by Herbert Xu's avatar Herbert Xu
Browse files

crypto: acomp - Clone folios properly



The folios contain references to the request itself so they must
be setup again in the cloned request.

Fixes: 5f3437e9 ("crypto: acomp - Simplify folio handling")
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 8f66ccbd
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -566,5 +566,23 @@ int acomp_walk_virt(struct acomp_walk *__restrict walk,
}
EXPORT_SYMBOL_GPL(acomp_walk_virt);

struct acomp_req *acomp_request_clone(struct acomp_req *req,
				      size_t total, gfp_t gfp)
{
	struct acomp_req *nreq;

	nreq = container_of(crypto_request_clone(&req->base, total, gfp),
			    struct acomp_req, base);
	if (nreq == req)
		return req;

	if (req->src == &req->chain.ssg)
		nreq->src = &nreq->chain.ssg;
	if (req->dst == &req->chain.dsg)
		nreq->dst = &nreq->chain.dsg;
	return nreq;
}
EXPORT_SYMBOL_GPL(acomp_request_clone);

MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Asynchronous compression type");
+2 −6
Original line number Diff line number Diff line
@@ -551,11 +551,7 @@ static inline struct acomp_req *acomp_request_on_stack_init(
	return req;
}

static inline struct acomp_req *acomp_request_clone(struct acomp_req *req,
						    size_t total, gfp_t gfp)
{
	return container_of(crypto_request_clone(&req->base, total, gfp),
			    struct acomp_req, base);
}
struct acomp_req *acomp_request_clone(struct acomp_req *req,
				      size_t total, gfp_t gfp);

#endif