File tree Expand file tree Collapse file tree 3 files changed +14
-13
lines changed Expand file tree Collapse file tree 3 files changed +14
-13
lines changed Original file line number Diff line number Diff line change @@ -45,10 +45,9 @@ struct cryptomgr_param {
45
45
} nu32 ;
46
46
} attrs [CRYPTO_MAX_ATTRS ];
47
47
48
- char larval [CRYPTO_MAX_ALG_NAME ];
49
48
char template [CRYPTO_MAX_ALG_NAME ];
50
49
51
- struct completion * completion ;
50
+ struct crypto_larval * larval ;
52
51
53
52
u32 otype ;
54
53
u32 omask ;
@@ -87,7 +86,8 @@ static int cryptomgr_probe(void *data)
87
86
crypto_tmpl_put (tmpl );
88
87
89
88
out :
90
- complete_all (param -> completion );
89
+ complete_all (& param -> larval -> completion );
90
+ crypto_alg_put (& param -> larval -> alg );
91
91
kfree (param );
92
92
module_put_and_exit (0 );
93
93
}
@@ -187,18 +187,19 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval)
187
187
param -> otype = larval -> alg .cra_flags ;
188
188
param -> omask = larval -> mask ;
189
189
190
- memcpy (param -> larval , larval -> alg .cra_name , CRYPTO_MAX_ALG_NAME );
191
-
192
- param -> completion = & larval -> completion ;
190
+ crypto_alg_get (& larval -> alg );
191
+ param -> larval = larval ;
193
192
194
193
thread = kthread_run (cryptomgr_probe , param , "cryptomgr_probe" );
195
194
if (IS_ERR (thread ))
196
- goto err_free_param ;
195
+ goto err_put_larval ;
197
196
198
197
wait_for_completion_interruptible (& larval -> completion );
199
198
200
199
return NOTIFY_STOP ;
201
200
201
+ err_put_larval :
202
+ crypto_alg_put (& larval -> alg );
202
203
err_free_param :
203
204
kfree (param );
204
205
err_put_module :
Original file line number Diff line number Diff line change @@ -34,12 +34,6 @@ EXPORT_SYMBOL_GPL(crypto_alg_sem);
34
34
BLOCKING_NOTIFIER_HEAD (crypto_chain );
35
35
EXPORT_SYMBOL_GPL (crypto_chain );
36
36
37
- static inline struct crypto_alg * crypto_alg_get (struct crypto_alg * alg )
38
- {
39
- atomic_inc (& alg -> cra_refcnt );
40
- return alg ;
41
- }
42
-
43
37
struct crypto_alg * crypto_mod_get (struct crypto_alg * alg )
44
38
{
45
39
return try_module_get (alg -> cra_module ) ? crypto_alg_get (alg ) : NULL ;
Original file line number Diff line number Diff line change @@ -103,6 +103,12 @@ int crypto_register_notifier(struct notifier_block *nb);
103
103
int crypto_unregister_notifier (struct notifier_block * nb );
104
104
int crypto_probing_notify (unsigned long val , void * v );
105
105
106
+ static inline struct crypto_alg * crypto_alg_get (struct crypto_alg * alg )
107
+ {
108
+ atomic_inc (& alg -> cra_refcnt );
109
+ return alg ;
110
+ }
111
+
106
112
static inline void crypto_alg_put (struct crypto_alg * alg )
107
113
{
108
114
if (atomic_dec_and_test (& alg -> cra_refcnt ) && alg -> cra_destroy )
You can’t perform that action at this time.
0 commit comments