From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, "J. Paul Reed" <preed@sigkill.com>,
Dmitry Vyukov <dvyukov@google.com>,
Herbert Xu <herbert@gondor.apana.org.au>
Subject: [PATCH 3.10 18/18] Revert: "crypto: af_alg - Disallow bind/setkey/... after accept(2)"
Date: Mon, 14 Mar 2016 10:53:16 -0700 [thread overview]
Message-ID: <20160314175042.008529950@linuxfoundation.org> (raw)
In-Reply-To: <20160314175041.432810454@linuxfoundation.org>
3.10-stable review patch. If anyone has any objections, please let me know.
------------------
This reverts commit 5a707f0972e1c9d8a4a921ddae79d0f9dc36a341 which is
commit c840ac6af3f8713a71b4d2363419145760bd6044 upstream.
It's been widely reported that this patch breaks existing userspace
applications when backported to the stable kernel releases. As no fix
seems to be forthcoming, just revert it to let systems work again.
Reported-by: "J. Paul Reed" <preed@sigkill.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
crypto/af_alg.c | 35 +++--------------------------------
include/crypto/if_alg.h | 8 +++++---
2 files changed, 8 insertions(+), 35 deletions(-)
--- 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_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,
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
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, struc
sk2->sk_family = PF_ALG;
- if (!ask->refcnt++)
- sock_hold(sk);
+ sock_hold(sk);
alg_sk(sk2)->parent = sk;
alg_sk(sk2)->type = type;
--- a/include/crypto/if_alg.h
+++ b/include/crypto/if_alg.h
@@ -30,8 +30,6 @@ struct alg_sock {
struct sock *parent;
- unsigned int refcnt;
-
const struct af_alg_type *type;
void *private;
};
@@ -66,7 +64,6 @@ int af_alg_register_type(const struct af
int af_alg_unregister_type(const struct af_alg_type *type);
int af_alg_release(struct socket *sock);
-void af_alg_release_parent(struct sock *sk);
int af_alg_accept(struct sock *sk, struct socket *newsock);
int af_alg_make_sg(struct af_alg_sgl *sgl, void __user *addr, int len,
@@ -83,6 +80,11 @@ static inline struct alg_sock *alg_sk(st
return (struct alg_sock *)sk;
}
+static inline void af_alg_release_parent(struct sock *sk)
+{
+ sock_put(alg_sk(sk)->parent);
+}
+
static inline void af_alg_init_completion(struct af_alg_completion *completion)
{
init_completion(&completion->completion);
next prev parent reply other threads:[~2016-03-14 17:54 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-14 17:52 [PATCH 3.10 00/18] 3.10.101-stable review Greg Kroah-Hartman
2016-03-14 17:53 ` [PATCH 3.10 02/18] tracing: Fix check for cpu online when event is disabled Greg Kroah-Hartman
2016-03-14 17:53 ` [PATCH 3.10 03/18] ASoC: wm8994: Fix enum ctl accesses in a wrong type Greg Kroah-Hartman
2016-03-14 17:53 ` [PATCH 3.10 04/18] ASoC: wm8958: " Greg Kroah-Hartman
2016-03-14 17:53 ` [PATCH 3.10 05/18] wext: fix message delay/ordering Greg Kroah-Hartman
2016-03-14 17:53 ` [PATCH 3.10 06/18] mac80211: fix use of uninitialised values in RX aggregation Greg Kroah-Hartman
2016-03-14 17:53 ` [PATCH 3.10 07/18] mac80211: minstrel_ht: set default tx aggregation timeout to 0 Greg Kroah-Hartman
2016-03-14 17:53 ` [PATCH 3.10 08/18] powerpc: Fix dedotify for binutils >= 2.26 Greg Kroah-Hartman
2016-03-14 17:53 ` [PATCH 3.10 09/18] KVM: x86: move steal time initialization to vcpu entry time Greg Kroah-Hartman
2016-03-14 17:53 ` [PATCH 3.10 10/18] lib/ucs2_string: Add ucs2 -> utf8 helper functions Greg Kroah-Hartman
2016-03-14 17:53 ` [PATCH 3.10 11/18] efi: Use ucs2_as_utf8 in efivarfs instead of open coding a bad version Greg Kroah-Hartman
2016-03-14 17:53 ` [PATCH 3.10 12/18] efi: Do variable name validation tests in utf8 Greg Kroah-Hartman
2016-03-14 17:53 ` [PATCH 3.10 13/18] efi: Make our variable validation list include the guid Greg Kroah-Hartman
2016-03-14 17:53 ` [PATCH 3.10 14/18] efi: Make efivarfs entries immutable by default Greg Kroah-Hartman
2016-03-14 17:53 ` [PATCH 3.10 15/18] efi: Add pstore variables to the deletion whitelist Greg Kroah-Hartman
2016-03-14 17:53 ` [PATCH 3.10 16/18] lib/ucs2_string: Correct ucs2 -> utf8 conversion Greg Kroah-Hartman
2016-03-14 17:53 ` [PATCH 3.10 17/18] modules: fix longstanding /proc/kallsyms vs module insertion race Greg Kroah-Hartman
2016-03-14 17:53 ` Greg Kroah-Hartman [this message]
2016-03-14 23:14 ` [PATCH 3.10 00/18] 3.10.101-stable review Shuah Khan
2016-03-15 2:37 ` Guenter Roeck
2016-03-16 3:08 ` Guenter Roeck
2016-03-16 4:09 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160314175042.008529950@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=dvyukov@google.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-kernel@vger.kernel.org \
--cc=preed@sigkill.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).