aboutsummaryrefslogtreecommitdiff
path: root/crypto/af_alg.c
diff options
context:
space:
mode:
authorAlex Shi <alex.shi@linaro.org>2016-03-18 11:41:51 +0800
committerAlex Shi <alex.shi@linaro.org>2016-03-18 16:01:49 +0800
commit70e00db9eb8ffc4dcaf5f035ec6a4440ba428794 (patch)
treeea67e279adedc950c3d4d8e98546b3823a2b3e93 /crypto/af_alg.c
parent34e0913e457f8469667faf5fa600447aa93371cf (diff)
parentdfbed80c63bb8d965067da3a6dbcc4682edcce0c (diff)
Merge remote-tracking branch 'lts/linux-3.14.y' into linux-linaro-lsk-v3.14lsk-v3.14-16.03linux-linaro-lsk-v3.14
Conflicts: Most of conflicts are due to efivar_validate() change which introduced a new parameter to check efi guid. I added efi guid for this change in sanity_check()/efivar_create() in drivers/firmware/efi/efivars.c and keep new efivar_validate() in drivers/firmware/efi/vars.c, since it's newer than LSK version. nothing need mentioned in include/linux/efi.h
Diffstat (limited to 'crypto/af_alg.c')
-rw-r--r--crypto/af_alg.c35
1 files changed, 3 insertions, 32 deletions
diff --git a/crypto/af_alg.c b/crypto/af_alg.c
index 1971f3ccb09a..eeb2fb239934 100644
--- a/crypto/af_alg.c
+++ b/crypto/af_alg.c
@@ -125,23 +125,6 @@ int af_alg_release(struct socket *sock)
}
EXPORT_SYMBOL_GPL(af_alg_release);
-void af_alg_release_parent(struct sock *sk)
-{
- struct alg_sock *ask = alg_sk(sk);
- bool last;
-
- sk = ask->parent;
- ask = alg_sk(sk);
-
- lock_sock(sk);
- last = !--ask->refcnt;
- release_sock(sk);
-
- if (last)
- sock_put(sk);
-}
-EXPORT_SYMBOL_GPL(af_alg_release_parent);
-
static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
{
struct sock *sk = sock->sk;
@@ -149,7 +132,6 @@ static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
struct sockaddr_alg *sa = (void *)uaddr;
const struct af_alg_type *type;
void *private;
- int err;
if (sock->state == SS_CONNECTED)
return -EINVAL;
@@ -175,22 +157,16 @@ static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
return PTR_ERR(private);
}
- err = -EBUSY;
lock_sock(sk);
- if (ask->refcnt)
- goto unlock;
swap(ask->type, type);
swap(ask->private, private);
- err = 0;
-
-unlock:
release_sock(sk);
alg_do_release(type, private);
- return err;
+ return 0;
}
static int alg_setkey(struct sock *sk, char __user *ukey,
@@ -223,15 +199,11 @@ static int alg_setsockopt(struct socket *sock, int level, int optname,
struct sock *sk = sock->sk;
struct alg_sock *ask = alg_sk(sk);
const struct af_alg_type *type;
- int err = -EBUSY;
+ int err = -ENOPROTOOPT;
lock_sock(sk);
- if (ask->refcnt)
- goto unlock;
-
type = ask->type;
- err = -ENOPROTOOPT;
if (level != SOL_ALG || !type)
goto unlock;
@@ -280,8 +252,7 @@ int af_alg_accept(struct sock *sk, struct socket *newsock)
sk2->sk_family = PF_ALG;
- if (!ask->refcnt++)
- sock_hold(sk);
+ sock_hold(sk);
alg_sk(sk2)->parent = sk;
alg_sk(sk2)->type = type;