Unverified Commit a350dc6e authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!2977 Backport crypto bugfix

Merge Pull Request from: @ci-robot 
 
PR sync from: Yi Yang <yiyang13@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/GNC77OQL5H3RZUWMUSVQ57OYDB46BPOB/ 
crypto bugfix and fix kabi broken.

Herbert Xu (1):
  crypto: api - Use work queue in crypto_destroy_instance

Yi Yang (1):
  crypto: fix kabi broken in struct crypto_instance


-- 
2.25.1
 
https://gitee.com/openeuler/kernel/issues/I8J49F 
 
Link:https://gitee.com/openeuler/kernel/pulls/2977

 

Reviewed-by: default avatarLiu YongQiang <liuyongqiang13@huawei.com>
Signed-off-by: default avatarZhang Changzhong <zhangchangzhong@huawei.com>
parents 6a02f116 917ed04e
Loading
Loading
Loading
Loading
+27 −2
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <linux/rtnetlink.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/workqueue.h>

#include "internal.h"

@@ -87,13 +88,37 @@ static void crypto_free_instance(struct crypto_instance *inst)
	inst->alg.cra_type->free(inst);
}

static void crypto_destroy_instance_workfn(struct work_struct *w)
{
	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 *inst = (void *)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(&work->free_work, crypto_destroy_instance_workfn);
	schedule_work(&work->free_work);
}

static struct list_head *crypto_more_spawns(struct crypto_alg *alg,
+6 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
#include <linux/list.h>
#include <linux/kernel.h>
#include <linux/skbuff.h>
#include <linux/workqueue.h>

/*
 * Maximum values for blocksize and alignmask, used to allocate
@@ -46,6 +47,11 @@ 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;