Received: by 10.192.165.156 with SMTP id m28csp73929imm; Tue, 10 Apr 2018 16:43:56 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+wYEN/21FU/HJscPN0RukmszPp0RFLXqtyTTmxSzdLY0BSFlymjmFr9/1SDqrjdfRzzGVF X-Received: by 10.98.192.66 with SMTP id x63mr1976464pff.135.1523403836674; Tue, 10 Apr 2018 16:43:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523403836; cv=none; d=google.com; s=arc-20160816; b=zhUiTpTvHQqF/L13FOHiMEbXO8JrRuZIW2Xf/xquNTdydwz2Jx0Iu6AVOPPdK/NfNN breF+vwW16ms4K3MzThWk73UsSlREJb/r90jqmis1lDwNWD1Qb+pWiat7urMxsGxkLaR gkjtPUEBTsEBHLgmbFkIdn2SstIlHgyPJFUFw6c0+he+1H29fYOQT3KoeiHluPYAHmVv aQjDms6riOCcbftVjFNV7Y3o8NYDwjkA+elD4T0NPsH2eE1UHWQ1x3hjZm2YOA4vGFO4 hFH+BBFqq/6PNTFsjie/5G+1K+kCD5DLsPh9XNnZqdEaCRZbuJVpEycxEkU8BsWi22oH Cfdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=sMxMa4LZ/ppIJ+nv7J+1CvXNPVDmPKaZ+fgEWOwKE14=; b=iKuSWwZG2+7X6IzUS5dM7H4CaPqHuEw8VePnGgeGJhudDUvZdgZIDZmaBQ8TfEodpl AtoUxUvlc5UInkR15L7VUhn6R9F1eG4gd8y70SInSrGEV81Wd5TFrSVsTyvOfs+4cet5 3iWJopr1c0loZGLUReOmGpYUfoNuZIONLj3BwLZIEcn02Z9rlTZs9lNlwHNNvR70H3li BpqidjDFf9GBammHpR8TI/y969lJIMCZYdUj6sfhskhpftbUuz/MCzBIU82k0X5RCh/L Hoha49TZru1dxzeo/2ScnAD944P14UTYeW1Zld37VilLBQvndIQaaJoXqTa11xSysuo/ fiNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s21si2951644pfi.87.2018.04.10.16.43.20; Tue, 10 Apr 2018 16:43:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753536AbeDJW1L (ORCPT + 99 others); Tue, 10 Apr 2018 18:27:11 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:37718 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751882AbeDJW1H (ORCPT ); Tue, 10 Apr 2018 18:27:07 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 557E5B13; Tue, 10 Apr 2018 22:27:06 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peng Li , Mingguang Qu , "David S. Miller" , Sasha Levin Subject: [PATCH 4.15 013/168] net: hns3: free the ring_data structrue when change tqps Date: Wed, 11 Apr 2018 00:22:35 +0200 Message-Id: <20180410212800.774687234@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212800.144079021@linuxfoundation.org> References: <20180410212800.144079021@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Peng Li [ Upstream commit 99fdf6b1cadf41bb253408589788f025027274f3 ] This patch fixes a memory leak problems in change tqps process, the function hns3_uninit_all_ring and hns3_init_all_ring may be called many times. Signed-off-by: Peng Li Signed-off-by: Mingguang Qu Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c @@ -2785,8 +2785,12 @@ int hns3_uninit_all_ring(struct hns3_nic h->ae_algo->ops->reset_queue(h, i); hns3_fini_ring(priv->ring_data[i].ring); + devm_kfree(priv->dev, priv->ring_data[i].ring); hns3_fini_ring(priv->ring_data[i + h->kinfo.num_tqps].ring); + devm_kfree(priv->dev, + priv->ring_data[i + h->kinfo.num_tqps].ring); } + devm_kfree(priv->dev, priv->ring_data); return 0; }