Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753792AbbLAPUP (ORCPT ); Tue, 1 Dec 2015 10:20:15 -0500 Received: from mail-pa0-f50.google.com ([209.85.220.50]:33875 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750790AbbLAPUM (ORCPT ); Tue, 1 Dec 2015 10:20:12 -0500 Message-ID: <1448983207.25582.29.camel@edumazet-glaptop2.roam.corp.google.com> Subject: [PATCH net] ipv6: sctp: implement sctp_v6_destroy_sock() From: Eric Dumazet To: Daniel Borkmann Cc: Dmitry Vyukov , "David S. Miller" , Alexey Kuznetsov , James Morris , Hideaki YOSHIFUJI , Patrick McHardy , netdev , LKML , Vlad Yasevich , Neil Horman , linux-sctp@vger.kernel.org, syzkaller , Kostya Serebryany , Alexander Potapenko , Sasha Levin , Eric Dumazet Date: Tue, 01 Dec 2015 07:20:07 -0800 In-Reply-To: <1448980723.25582.24.camel@edumazet-glaptop2.roam.corp.google.com> References: <1448977016.25582.18.camel@edumazet-glaptop2.roam.corp.google.com> <565DA9BE.3060006@iogearbox.net> <1448979404.25582.23.camel@edumazet-glaptop2.roam.corp.google.com> <565DAD8D.9020800@iogearbox.net> <1448980723.25582.24.camel@edumazet-glaptop2.roam.corp.google.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1346 Lines: 47 From: Eric Dumazet 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 --- 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 897c01c029ca..9d0b9bae9052 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -7375,6 +7375,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, @@ -7384,7 +7391,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, -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/