diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2016-01-13 01:59:03 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2016-01-18 05:16:32 -0500 |
commit | 6a935170a980024dd29199e9dbb5c4da4767a1b9 (patch) | |
tree | 367c9181e955fc1d2bd242defe62593705575c8e /crypto/af_alg.c | |
parent | 70401f4edc331c3c8068fc13b93d784a72de053e (diff) |
crypto: af_alg - Allow af_af_alg_release_parent to be called on nokey path
This patch allows af_alg_release_parent to be called even for
nokey sockets.
Cc: stable@vger.kernel.org
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/af_alg.c')
-rw-r--r-- | crypto/af_alg.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/crypto/af_alg.c b/crypto/af_alg.c index 6566d2eb0142..e7cb8367771d 100644 --- a/crypto/af_alg.c +++ b/crypto/af_alg.c | |||
@@ -133,6 +133,12 @@ void af_alg_release_parent(struct sock *sk) | |||
133 | bool last; | 133 | bool last; |
134 | 134 | ||
135 | sk = ask->parent; | 135 | sk = ask->parent; |
136 | |||
137 | if (ask->nokey_refcnt && !ask->refcnt) { | ||
138 | sock_put(sk); | ||
139 | return; | ||
140 | } | ||
141 | |||
136 | ask = alg_sk(sk); | 142 | ask = alg_sk(sk); |
137 | 143 | ||
138 | lock_sock(sk); | 144 | lock_sock(sk); |
@@ -268,8 +274,8 @@ int af_alg_accept(struct sock *sk, struct socket *newsock) | |||
268 | struct alg_sock *ask = alg_sk(sk); | 274 | struct alg_sock *ask = alg_sk(sk); |
269 | const struct af_alg_type *type; | 275 | const struct af_alg_type *type; |
270 | struct sock *sk2; | 276 | struct sock *sk2; |
277 | unsigned int nokey; | ||
271 | int err; | 278 | int err; |
272 | bool nokey; | ||
273 | 279 | ||
274 | lock_sock(sk); | 280 | lock_sock(sk); |
275 | type = ask->type; | 281 | type = ask->type; |
@@ -302,6 +308,7 @@ int af_alg_accept(struct sock *sk, struct socket *newsock) | |||
302 | sock_hold(sk); | 308 | sock_hold(sk); |
303 | alg_sk(sk2)->parent = sk; | 309 | alg_sk(sk2)->parent = sk; |
304 | alg_sk(sk2)->type = type; | 310 | alg_sk(sk2)->type = type; |
311 | alg_sk(sk2)->nokey_refcnt = nokey; | ||
305 | 312 | ||
306 | newsock->ops = type->ops; | 313 | newsock->ops = type->ops; |
307 | newsock->state = SS_CONNECTED; | 314 | newsock->state = SS_CONNECTED; |