From c3c00ed2dca93cd5ad2902ac28f5d7fa74c1865c Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 27 Dec 2024 16:19:50 +0000 Subject: [PATCH] Revert "crypto: api - Add crypto_tfm_get" This reverts commit e470d423b0f6ffd3977e74d1d1eef70cc58f18dd which is commit ae131f4970f0778f35ed06aeb15bde2fbc1d9619 upstream. It breaks the Android kernel abi and can be brought back in the future in an abi-safe way if it is really needed. Bug: 161946584 Change-Id: I5292b6943ca50ef57b754862ddd33f7a782310c9 Signed-off-by: Greg Kroah-Hartman --- crypto/api.c | 4 ---- crypto/internal.h | 6 ------ include/linux/crypto.h | 1 - 3 files changed, 11 deletions(-) diff --git a/crypto/api.c b/crypto/api.c index 22089630f3dd..b022702f6436 100644 --- a/crypto/api.c +++ b/crypto/api.c @@ -408,7 +408,6 @@ struct crypto_tfm *__crypto_alloc_tfm(struct crypto_alg *alg, u32 type, goto out_err; tfm->__crt_alg = alg; - refcount_set(&tfm->refcnt, 1); err = crypto_init_ops(tfm, type, mask); if (err) @@ -508,7 +507,6 @@ void *crypto_create_tfm_node(struct crypto_alg *alg, tfm = (struct crypto_tfm *)(mem + tfmsize); tfm->__crt_alg = alg; tfm->node = node; - refcount_set(&tfm->refcnt, 1); err = frontend->init_tfm(tfm); if (err) @@ -621,8 +619,6 @@ void crypto_destroy_tfm(void *mem, struct crypto_tfm *tfm) if (IS_ERR_OR_NULL(mem)) return; - if (!refcount_dec_and_test(&tfm->refcnt)) - return; alg = tfm->__crt_alg; if (!tfm->exit && alg->cra_exit) diff --git a/crypto/internal.h b/crypto/internal.h index cc1500c32e96..932f0aafddc3 100644 --- a/crypto/internal.h +++ b/crypto/internal.h @@ -10,7 +10,6 @@ #include #include -#include #include #include #include @@ -185,10 +184,5 @@ static inline int crypto_is_test_larval(struct crypto_larval *larval) return larval->alg.cra_driver_name[0]; } -static inline struct crypto_tfm *crypto_tfm_get(struct crypto_tfm *tfm) -{ - return refcount_inc_not_zero(&tfm->refcnt) ? tfm : ERR_PTR(-EOVERFLOW); -} - #endif /* _CRYPTO_INTERNAL_H */ diff --git a/include/linux/crypto.h b/include/linux/crypto.h index d354a2a7ac5f..e3c4be29aacc 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h @@ -642,7 +642,6 @@ int crypto_has_alg(const char *name, u32 type, u32 mask); */ struct crypto_tfm { - refcount_t refcnt; u32 crt_flags;