From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de ([195.135.220.15]:41352 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752203AbcAEP3k (ORCPT ); Tue, 5 Jan 2016 10:29:40 -0500 From: Jiri Slaby To: stable@vger.kernel.org Cc: Eric Dumazet , "David S . Miller" , Jiri Slaby Subject: [patch added to the 3.12 stable tree] ipv6: sctp: implement sctp_v6_destroy_sock() Date: Tue, 5 Jan 2016 16:28:21 +0100 Message-Id: <1452007726-3747-20-git-send-email-jslaby@suse.cz> In-Reply-To: <1452007726-3747-1-git-send-email-jslaby@suse.cz> References: <1452007726-3747-1-git-send-email-jslaby@suse.cz> Sender: stable-owner@vger.kernel.org List-ID: From: Eric Dumazet This patch has been added to the 3.12 stable tree. If you have any objections, please let us know. =============== [ Upstream commit 602dd62dfbda3e63a2d6a3cbde953ebe82bf5087 ] Dmitry Vyukov reported a memory leak using IPV6 SCTP sockets. We need to call inet6_destroy_sock() to properly release inet6 specific fields. Reported-by: Dmitry Vyukov Signed-off-by: Eric Dumazet Acked-by: Daniel Borkmann Signed-off-by: David S. Miller Signed-off-by: Jiri Slaby --- net/sctp/socket.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 09b147e0fe57..cf9ea9dacfe5 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -7130,6 +7130,13 @@ struct proto sctp_prot = { #if IS_ENABLED(CONFIG_IPV6) +#include +static void sctp_v6_destroy_sock(struct sock *sk) +{ + sctp_destroy_sock(sk); + inet6_destroy_sock(sk); +} + struct proto sctpv6_prot = { .name = "SCTPv6", .owner = THIS_MODULE, @@ -7139,7 +7146,7 @@ struct proto sctpv6_prot = { .accept = sctp_accept, .ioctl = sctp_ioctl, .init = sctp_init_sock, - .destroy = sctp_destroy_sock, + .destroy = sctp_v6_destroy_sock, .shutdown = sctp_shutdown, .setsockopt = sctp_setsockopt, .getsockopt = sctp_getsockopt, -- 2.6.4