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

!2964 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/YCCTMXTSB6VFVNXM3RXQHZKA7F4EYYV2/ 
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/I8J49D 
 
Link:https://gitee.com/openeuler/kernel/pulls/2964

 

Reviewed-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents 65813911 cf635a6b
Loading
Loading
Loading
Loading
+27 −2
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@
#include <linux/rtnetlink.h>
#include <linux/rtnetlink.h>
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/string.h>
#include <linux/workqueue.h>


#include "internal.h"
#include "internal.h"


@@ -68,13 +69,37 @@ static void crypto_free_instance(struct crypto_instance *inst)
	inst->alg.cra_type->free(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)
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;
	struct crypto_template *tmpl = inst->tmpl;


	work = kzalloc(sizeof(*work), GFP_ATOMIC);
	if (!work) {
		crypto_free_instance(inst);
		crypto_free_instance(inst);
		crypto_tmpl_put(tmpl);
		crypto_tmpl_put(tmpl);
		return;
	}
	work->instance = inst;

	INIT_WORK(&work->free_work, crypto_destroy_instance_workfn);
	schedule_work(&work->free_work);
}
}


/*
/*
+6 −0
Original line number Original line Diff line number Diff line
@@ -10,6 +10,7 @@
#include <linux/crypto.h>
#include <linux/crypto.h>
#include <linux/list.h>
#include <linux/list.h>
#include <linux/kernel.h>
#include <linux/kernel.h>
#include <linux/workqueue.h>


/*
/*
 * Maximum values for blocksize and alignmask, used to allocate
 * Maximum values for blocksize and alignmask, used to allocate
@@ -43,6 +44,11 @@ struct crypto_type {
	unsigned int tfmsize;
	unsigned int tfmsize;
};
};


struct crypto_instance_freework {
	struct crypto_instance *instance;
	struct work_struct free_work;
};

struct crypto_instance {
struct crypto_instance {
	struct crypto_alg alg;
	struct crypto_alg alg;