Received: by 10.213.65.68 with SMTP id h4csp1866457imn; Mon, 19 Mar 2018 15:43:07 -0700 (PDT) X-Google-Smtp-Source: AG47ELu0Stu19aiTi8B1MKpdbbvG0b+oMZEWcGDi57F13hoVQechmPCZfsLIJRrM60TbXpDjF62O X-Received: by 10.99.37.70 with SMTP id l67mr6177704pgl.106.1521499387048; Mon, 19 Mar 2018 15:43:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521499387; cv=none; d=google.com; s=arc-20160816; b=XoPOUPN5hkuWyfS8rf6s4g8QRBOm/FUOX382G42UuQWAMabhCNE/BiwgwaZpXeKGjy zgB1XHG/DknMiEpxtuYNIhmaGjbfX05OZcDGOfkNghenWxtEvYdk4saOkfFMPlS0srTr GaNakvy0nGMtHtho9LjHfW6aaf/Oz9nnz4wfScZPIDiPkeGsHLTyeoD9xYPSHGKAW/xC NHDEHrE+70APgw0BcLlfQXiZamZZ5NzwvxUWJDR9auZd0Db9EW6AEBC7wEpCnuPeesxh ipJZLpc6eqQ0CemGhxCg/cvlCwsZ3iNufEwyFy2SbUIExRmvVQS/5Dv3EkJV5Km3P4Dy ChvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=SgWUAAT8auFosX9XYqo878ooCYpofhsw8BejNKXX4xY=; b=UMuWmMpzpUHJdjSPhsokPwZCEvjLwVVGhnNOFK9/yYiv/gs4+s419oIUdCzNZ8+FQN /PLbTGRAba5KDoB76XrXl6PtxE4nHIABBSX2xATwmVpM5YY6g+I8o6IoJhmG44ALiJ8d cDynvSagd5v06SWqk7JH+seRZeM+b+22CZOL6F8h5c6L+T/YlxrL6nJq9owXuNR1JVxe T17db/eg6BGDIbtPw8goOvl3R6e3074EzIMYdQk9z/9k3deX+S6uoNWdPk8OVOm/DwxK 0n6tuuFn5cX+xPLtyYUTK28Zbg1BsFXo1grLNe8Fcwdl/OaK83OSfoklQlidHrvIbSSv 5uoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=bzIiS1FM; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bh7-v6si248730plb.711.2018.03.19.15.42.53; Mon, 19 Mar 2018 15:43:07 -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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=bzIiS1FM; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936727AbeCSWkT (ORCPT + 99 others); Mon, 19 Mar 2018 18:40:19 -0400 Received: from mail-by2nam01on0103.outbound.protection.outlook.com ([104.47.34.103]:19764 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932883AbeCSPrS (ORCPT ); Mon, 19 Mar 2018 11:47:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=SgWUAAT8auFosX9XYqo878ooCYpofhsw8BejNKXX4xY=; b=bzIiS1FMRoVB6a18SG3PWZzIFkYTkq2pNpD4kayn5eDPDEj005g7M7Tk7GXD8JGYHRCk7mY8XVqt1+rlivTesAWSS02AxW0AFtewm6+mgI4QfVHPWxXxKMXniPsnyNbt3HW+wIKXRUZUklrRWW8kUt4NrnZWsk0O++kVgBK490k= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1013.namprd21.prod.outlook.com (52.132.133.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.0; Mon, 19 Mar 2018 15:47:12 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 15:47:12 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Peng Li , Mingguang Qu , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 013/124] net: hns3: free the ring_data structrue when change tqps Thread-Topic: [PATCH AUTOSEL for 4.15 013/124] net: hns3: free the ring_data structrue when change tqps Thread-Index: AQHTv5mLBeUCMcN6c0asxgyMf4Ju7A== Date: Mon, 19 Mar 2018 15:47:11 +0000 Message-ID: <20180319154645.11350-13-alexander.levin@microsoft.com> References: <20180319154645.11350-1-alexander.levin@microsoft.com> In-Reply-To: <20180319154645.11350-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1013;7:n4Zh/Vx14Ty0mZMU6QvmASH0T9jvnZ/56OHxHD+3E0cA99W0EBm1cH5VDEJbPZHlX98FEXnUyt2pmOV9VDcnqjMC7Xt0Lh9UzTGbHfxz1X0oFk+jQCsb1IyAEL9dBWKOQwKrbGgam+mpsNBfjUiSisNr0DCYR7eBQTtpVqGIRb6gQ+S7kerYlE7U5/bP75hL8N8G4e+D1K9Rp1kHrlfgJJR/5+WGnWVJjO90pQ526GS8WlSNIXdHoEDZF/dxi0uR;20:E6QjD2Xf+uR5z/OQFi1am/qK1uWe1TtU46XPCc17fUC7UXWdb33K6WAksFIgYfmGS8P3/5xQVjkwN8Xw2y0grMzzKidih08P6XW6NVQfvlxjt8K5/oq2gkD7knfSoZJ0wHPPOHaca8QcyhR/flCr9n5PY/p2DPQHTwtSWRQzszg= x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 70c28d5f-33bf-4482-7c7c-08d58db0ae4e x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1013; x-ms-traffictypediagnostic: DM5PR2101MB1013: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(50582790962513); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3231221)(944501300)(52105095)(3002001)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011);SRVR:DM5PR2101MB1013;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1013; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(396003)(39860400002)(346002)(376002)(39380400002)(189003)(199004)(86612001)(316002)(26005)(72206003)(4326008)(25786009)(110136005)(10290500003)(86362001)(575784001)(54906003)(53936002)(36756003)(107886003)(3280700002)(14454004)(22452003)(6506007)(5660300001)(68736007)(99286004)(186003)(478600001)(76176011)(2950100002)(10090500001)(102836004)(6116002)(5250100002)(2501003)(97736004)(3660700001)(106356001)(81156014)(81166006)(8676002)(8936002)(7736002)(305945005)(2900100001)(105586002)(3846002)(1076002)(66066001)(6436002)(2906002)(6512007)(6486002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1013;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: y3ox9F74+EKnLVUjwnGIJczBl9xshIvpkvPNDQBLb8lbBHlah6FQzdUEIISHcaIksMMSxokx/+fgAawmDMQlS6lioDFnFZ20kOmK2ndxIBfAm9rlFSA0oYLnFjH2CZHrGXqb1JSVygswr9Wlye0iMLTNsR6JJTAktUq7yqr9ucmAIY+yWmhOzrONeLathhNwBt78QVJ6V06e0YpPXnNrFXyHWmFmtWvpVRIQA2Qnmz/Hwu1fhgOZUwoU/QfXrmiqmERYpywnv9koOPcxViJOqCE+GaWOmSXPsoeDdQVEjpakjY1vFCPNhOd2E2ezyPCWXBqd2JcbPBGQVzdd+GAzFA== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 70c28d5f-33bf-4482-7c7c-08d58db0ae4e X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 15:47:11.6780 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1013 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c b/drive= rs/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c index 59415090ff0f..853f273da22d 100644 --- 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_priv *priv) h->ae_algo->ops->reset_queue(h, i); =20 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); =20 return 0; } --=20 2.14.1