stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Slaby <jslaby@suse.cz>
To: stable@vger.kernel.org
Cc: Herbert Xu <herbert@gondor.apana.org.au>, Jiri Slaby <jslaby@suse.cz>
Subject: [patch added to 3.12-stable] crypto: af_alg - Fix socket double-free when accept fails
Date: Mon, 15 Feb 2016 17:12:38 +0100	[thread overview]
Message-ID: <1455552767-7413-10-git-send-email-jslaby@suse.cz> (raw)
In-Reply-To: <1455552767-7413-1-git-send-email-jslaby@suse.cz>

From: Herbert Xu <herbert@gondor.apana.org.au>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit a383292c86663bbc31ac62cc0c04fc77504636a6 upstream.

When we fail an accept(2) call we will end up freeing the socket
twice, once due to the direct sk_free call and once again through
newsock.

This patch fixes this by removing the sk_free call.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 crypto/af_alg.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/crypto/af_alg.c b/crypto/af_alg.c
index d7fefeb3d1a7..0ca108f3c840 100644
--- a/crypto/af_alg.c
+++ b/crypto/af_alg.c
@@ -275,10 +275,8 @@ int af_alg_accept(struct sock *sk, struct socket *newsock)
 	security_sk_clone(sk, sk2);
 
 	err = type->accept(ask->private, sk2);
-	if (err) {
-		sk_free(sk2);
+	if (err)
 		goto unlock;
-	}
 
 	sk2->sk_family = PF_ALG;
 
-- 
2.7.1


  parent reply	other threads:[~2016-02-15 16:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-15 16:12 [patch added to 3.12-stable] USB: serial: ftdi_sio: add support for Yaesu SCU-18 cable Jiri Slaby
2016-02-15 16:12 ` [patch added to 3.12-stable] USB: cp210x: add ID for IAI USB to RS485 adaptor Jiri Slaby
2016-02-15 16:12 ` [patch added to 3.12-stable] USB: serial: option: Adding support for Telit LE922 Jiri Slaby
2016-02-15 16:12 ` [patch added to 3.12-stable] USB: option: fix Cinterion AHxx enumeration Jiri Slaby
2016-02-15 16:12 ` [patch added to 3.12-stable] tty: Fix GPF in flush_to_ldisc() Jiri Slaby
2016-02-15 16:12 ` [patch added to 3.12-stable] tty: Fix unsafe ldisc reference via ioctl(TIOCGETD) Jiri Slaby
2016-02-15 16:12 ` [patch added to 3.12-stable] xhci: fix usb2 resume timing and races Jiri Slaby
2016-02-15 16:12 ` [patch added to 3.12-stable] ext4: Fix handling of extended tv_sec Jiri Slaby
2016-02-15 16:12 ` [patch added to 3.12-stable] crypto: af_alg - Disallow bind/setkey/... after accept(2) Jiri Slaby
2016-02-15 16:12 ` Jiri Slaby [this message]
2016-02-15 16:12 ` [patch added to 3.12-stable] AHCI: Fix softreset failed issue of Port Multiplier Jiri Slaby
2016-02-15 16:12 ` [patch added to 3.12-stable] libata: disable forced PORTS_IMPL for >= AHCI 1.3 Jiri Slaby
2016-02-15 16:12 ` [patch added to 3.12-stable] ahci: Intel DNV device IDs SATA Jiri Slaby
2016-02-15 16:12 ` [patch added to 3.12-stable] crypto: algif_hash - wait for crypto_ahash_init() to complete Jiri Slaby
2016-02-15 16:12 ` [patch added to 3.12-stable] EVM: Use crypto_memneq() for digest comparisons Jiri Slaby
2016-02-15 16:12 ` [patch added to 3.12-stable] crypto: user - lock crypto_alg_list on alg dump Jiri Slaby
2016-02-15 16:12 ` [patch added to 3.12-stable] FS-Cache: Increase reference of parent after registering, netfs success Jiri Slaby
2016-02-15 16:12 ` [patch added to 3.12-stable] FS-Cache: Don't override netfs's primary_index if registering failed Jiri Slaby
2016-02-15 16:12 ` [patch added to 3.12-stable] binfmt_elf: Don't clobber passed executable's file header Jiri Slaby

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=1455552767-7413-10-git-send-email-jslaby@suse.cz \
    --to=jslaby@suse.cz \
    --cc=herbert@gondor.apana.org.au \
    --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).