From patchwork Thu Jun 5 15:08:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pablo Neira Ayuso X-Patchwork-Id: 31426 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f72.google.com (mail-qa0-f72.google.com [209.85.216.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 587FB20BF9 for ; Thu, 5 Jun 2014 15:09:09 +0000 (UTC) Received: by mail-qa0-f72.google.com with SMTP id hw13sf4587779qab.11 for ; Thu, 05 Jun 2014 08:09:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=ayEHbae1c6JYFAD38koDA0vzX5YkKwI8H/5jPUhD+vA=; b=c62LIdprFpqWcchRBN8mRocI6ch0yvqSPEVGvi7laikbGOIs1OXpeWHLNY/BMOA4px njPNH/5r8ks77Yu+IvbCd1jtB6SBD5eI7jrSf6dyYT1AQyolsLrUSOAjSvIgELx2U58M IsTcnm/NNEi6kr8awob5KdblQFvoupbsWXSqT1BQJfPYV/JUBBHKCOPUf5pqMIE0uaxb I6UaFtQ4e1E0aHPQkR64K84rO/MBVg4jMejVgwLTU8mWIqgo+tnJkCpaxfE8WFwVtt+7 IdxgYgWvm52EuUzul3NJ52htvjJvhc9YOfuQwP+3BEZccziF1Bf4tIPkVZjmONSXhiaq go9g== X-Gm-Message-State: ALoCoQmk6ig3pVMTLC2cBqMQrF/G2qzE8ngXbGQp97/Sq/8dR7io8i8CMrOFQWDEgwQKPvBx92ke X-Received: by 10.236.165.230 with SMTP id e66mr23084703yhl.6.1401980949158; Thu, 05 Jun 2014 08:09:09 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.28.195 with SMTP id 61ls231157qgz.77.gmail; Thu, 05 Jun 2014 08:09:09 -0700 (PDT) X-Received: by 10.220.123.201 with SMTP id q9mr1596410vcr.77.1401980949009; Thu, 05 Jun 2014 08:09:09 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id gg3si3901400veb.2.2014.06.05.08.09.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 05 Jun 2014 08:09:08 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id il7so1289119vcb.41 for ; Thu, 05 Jun 2014 08:09:08 -0700 (PDT) X-Received: by 10.58.216.163 with SMTP id or3mr1128039vec.80.1401980948899; Thu, 05 Jun 2014 08:09:08 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.54.6 with SMTP id vs6csp23950vcb; Thu, 5 Jun 2014 08:09:08 -0700 (PDT) X-Received: by 10.60.57.164 with SMTP id j4mr68391535oeq.24.1401980948435; Thu, 05 Jun 2014 08:09:08 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w10si10808414oer.91.2014.06.05.08.09.08; Thu, 05 Jun 2014 08:09:08 -0700 (PDT) Received-SPF: none (google.com: netdev-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752709AbaFEPJD (ORCPT + 3 others); Thu, 5 Jun 2014 11:09:03 -0400 Received: from mail.us.es ([193.147.175.20]:39224 "EHLO mail.us.es" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752632AbaFEPIg (ORCPT ); Thu, 5 Jun 2014 11:08:36 -0400 Received: (qmail 1925 invoked from network); 5 Jun 2014 17:08:33 +0200 Received: from unknown (HELO us.es) (192.168.2.14) by us.es with SMTP; 5 Jun 2014 17:08:33 +0200 Received: (qmail 4103 invoked by uid 507); 5 Jun 2014 15:08:33 -0000 X-Qmail-Scanner-Diagnostics: from 127.0.0.1 by antivirus4 (envelope-from , uid 501) with qmail-scanner-2.10 (clamdscan: 0.98.3/19060. spamassassin: 3.3.2. Clear:RC:1(127.0.0.1):SA:0(-101.2/7.5):. Processed in 1.891253 secs); 05 Jun 2014 15:08:33 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on antivirus4 X-Spam-Level: X-Spam-Status: No, score=-101.2 required=7.5 tests=BAYES_50,SMTPAUTH_US, USER_IN_WHITELIST autolearn=disabled version=3.3.2 X-Spam-ASN: AS12715 87.216.0.0/16 X-Envelope-From: pablo@netfilter.org Received: from unknown (HELO antivirus4) (127.0.0.1) by us.es with SMTP; 5 Jun 2014 15:08:31 -0000 Received: from 192.168.1.13 (192.168.1.13) by antivirus4 (F-Secure/fsigk_smtp/412/antivirus4); Thu, 05 Jun 2014 17:08:31 +0200 (CEST) X-Virus-Status: clean(F-Secure/fsigk_smtp/412/antivirus4) Received: (qmail 14028 invoked from network); 5 Jun 2014 17:08:31 +0200 Received: from 186.169.216.87.static.jazztel.es (HELO localhost.localdomain) (pneira@us.es@87.216.169.186) by mail.us.es with SMTP; 5 Jun 2014 17:08:31 +0200 From: Pablo Neira Ayuso To: netfilter-devel@vger.kernel.org Cc: davem@davemloft.net, netdev@vger.kernel.org Subject: [PATCH 1/6] netfilter: nfnetlink_acct: Fix memory leak Date: Thu, 5 Jun 2014 17:08:21 +0200 Message-Id: <1401980906-25290-2-git-send-email-pablo@netfilter.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1401980906-25290-1-git-send-email-pablo@netfilter.org> References: <1401980906-25290-1-git-send-email-pablo@netfilter.org> Sender: netdev-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: netdev@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: pablo@netfilter.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Mathieu Poirier Allocation of memory need only to happen once, that is after the proper checks on the NFACCT_FLAGS have been done. Otherwise the code can return without freeing already allocated memory. Signed-off-by: Mathieu Poirier Signed-off-by: Pablo Neira Ayuso --- net/netfilter/nfnetlink_acct.c | 1 - 1 file changed, 1 deletion(-) diff --git a/net/netfilter/nfnetlink_acct.c b/net/netfilter/nfnetlink_acct.c index 70e86bb..54af985 100644 --- a/net/netfilter/nfnetlink_acct.c +++ b/net/netfilter/nfnetlink_acct.c @@ -83,7 +83,6 @@ nfnl_acct_new(struct sock *nfnl, struct sk_buff *skb, return -EBUSY; } - nfacct = kzalloc(sizeof(struct nf_acct), GFP_KERNEL); if (tb[NFACCT_FLAGS]) { flags = ntohl(nla_get_be32(tb[NFACCT_FLAGS])); if (flags & ~NFACCT_F_QUOTA)