From patchwork Sun Aug 11 20:07:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wenwen Wang X-Patchwork-Id: 1145779 X-Patchwork-Delegate: jeffrey.t.kirsher@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=osuosl.org (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=cs.uga.edu Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 466f2S2G2qz9sDQ for ; Tue, 13 Aug 2019 00:52:15 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 62FA321548; Mon, 12 Aug 2019 14:52:14 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 55SGTKrX57f5; Mon, 12 Aug 2019 14:52:13 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 07E34203CA; Mon, 12 Aug 2019 14:52:13 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 9160D1BF322 for ; Sun, 11 Aug 2019 20:07:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 8A824203B3 for ; Sun, 11 Aug 2019 20:07:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sL5ci6qNStQI for ; Sun, 11 Aug 2019 20:07:55 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-yw1-f67.google.com (mail-yw1-f67.google.com [209.85.161.67]) by silver.osuosl.org (Postfix) with ESMTPS id C4EB420130 for ; Sun, 11 Aug 2019 20:07:55 +0000 (UTC) Received: by mail-yw1-f67.google.com with SMTP id z63so38057716ywz.9 for ; Sun, 11 Aug 2019 13:07:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=I/wDFVoI+mYQ74OtLuR5i4v0k0nbe35K0FGp9EAyx0w=; b=pIXlDgVcOEm/EIgI/2RsUPv++Y6y5rpBhX8wvg64pEbHHu/o9/bzbLKX5cF/QI7um5 iD8Kfq6ZQ1vep/VD7KldkfcOQY+deSy0lleliv8eFV+jUr606VXykf5oLf8pWW+iSe7v ZZkacw8hs4DocrcMyNXXKXJsJqU62Eojj4dRqSA4RShXo6kJ3LmNu/X04Ci25MyNJToM lMHSr7+mjfTqSfJ2bNZtRit7rhmVYmeEdF2KQesjtAtQyXh3I8IyOZwOZr1/ECqFGK/M JuVnxG5oJlv/hlWil6jkTfcpOnSeePFmHmIAMDWyamWKOI1VVyUl5gamyloQtBA7/FZN Lowg== X-Gm-Message-State: APjAAAWKXKyogSjXwpFla2/oWbDOcT1vN9s/GRnej4chADh1OJjXNUiA pgNQYMUBMGn8gpxlui2Zjk8= X-Google-Smtp-Source: APXvYqyoSDYPWu4RUOvnDARGMo8pOuQZ3RGQOV1HGXtNwNsBcsmUEeugZgXKGibzzlthU+3xSqElvw== X-Received: by 2002:a0d:f0c7:: with SMTP id z190mr2409714ywe.317.1565554074798; Sun, 11 Aug 2019 13:07:54 -0700 (PDT) Received: from localhost.localdomain (24-158-240-219.dhcp.smyr.ga.charter.com. [24.158.240.219]) by smtp.gmail.com with ESMTPSA id x138sm23418950ywg.4.2019.08.11.13.07.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 11 Aug 2019 13:07:54 -0700 (PDT) From: Wenwen Wang To: Wenwen Wang Date: Sun, 11 Aug 2019 15:07:47 -0500 Message-Id: <1565554067-4994-1-git-send-email-wenwen@cs.uga.edu> X-Mailer: git-send-email 2.7.4 X-Mailman-Approved-At: Mon, 12 Aug 2019 14:52:11 +0000 Subject: [Intel-wired-lan] [PATCH] net: ixgbe: fix memory leaks X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "open list:NETWORKING DRIVERS" , "moderated list:INTEL ETHERNET DRIVERS" , open list , "David S. Miller" MIME-Version: 1.0 Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" In ixgbe_configure_clsu32(), 'jump', 'input', and 'mask' are allocated through kzalloc() respectively in a for loop body. Then, ixgbe_clsu32_build_input() is invoked to build the input. If this process fails, next iteration of the for loop will be executed. However, the allocated 'jump', 'input', and 'mask' are not deallocated on this execution path, leading to memory leaks. Signed-off-by: Wenwen Wang Tested-by: Andrew Bowers --- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index cbaf712..6b7ea87 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -9490,6 +9490,10 @@ static int ixgbe_configure_clsu32(struct ixgbe_adapter *adapter, jump->mat = nexthdr[i].jump; adapter->jump_tables[link_uhtid] = jump; break; + } else { + kfree(mask); + kfree(input); + kfree(jump); } } return 0;