hulk inclusion category: bugfix bugzilla: 189311 CVE: N/A
--------------------------------
Fix kabi breakage in commit dd82a543420c ("[Backport] crypto: api - Use work queue in crypto_destroy_instance")
Signed-off-by: Yi Yang yiyang13@huawei.com --- crypto/algapi.c | 21 +++++++++++++++++---- include/crypto/algapi.h | 7 +++++-- 2 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/crypto/algapi.c b/crypto/algapi.c index 1ffd9358f009..9bf991a4246b 100644 --- a/crypto/algapi.c +++ b/crypto/algapi.c @@ -90,22 +90,35 @@ static void crypto_free_instance(struct crypto_instance *inst)
static void crypto_destroy_instance_workfn(struct work_struct *w) { - struct crypto_instance *inst = container_of(w, struct crypto_instance, - free_work); + struct crypto_instance_freework *work = container_of(w, + struct crypto_instance_freework, free_work); + struct crypto_instance *inst = work->instance; struct crypto_template *tmpl = inst->tmpl;
crypto_free_instance(inst); crypto_tmpl_put(tmpl); + + kfree(work); }
static void crypto_destroy_instance(struct crypto_alg *alg) { + struct crypto_instance_freework *work; struct crypto_instance *inst = container_of(alg, struct crypto_instance, alg); + struct crypto_template *tmpl = inst->tmpl; + + work = kzalloc(sizeof(*work), GFP_ATOMIC); + if (!work) { + crypto_free_instance(inst); + crypto_tmpl_put(tmpl); + return; + } + work->instance = inst;
- INIT_WORK(&inst->free_work, crypto_destroy_instance_workfn); - schedule_work(&inst->free_work); + INIT_WORK(&work->free_work, crypto_destroy_instance_workfn); + schedule_work(&work->free_work); }
static struct list_head *crypto_more_spawns(struct crypto_alg *alg, diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h index 432678570ce0..474140cd233c 100644 --- a/include/crypto/algapi.h +++ b/include/crypto/algapi.h @@ -46,14 +46,17 @@ struct crypto_type { unsigned int tfmsize; };
+struct crypto_instance_freework { + struct crypto_instance *instance; + struct work_struct free_work; +}; + struct crypto_instance { struct crypto_alg alg;
struct crypto_template *tmpl; struct hlist_node list;
- struct work_struct free_work; - void *__ctx[] CRYPTO_MINALIGN_ATTR; };