Received: by 10.213.65.68 with SMTP id h4csp2118139imn; Sun, 8 Apr 2018 20:09:24 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/q7fs2R+Hv3j5FcBPK84YDRw1izw9v0SsX+SoxMnPrBBRLfZkO3sUrnqPEvQAeUE3bfOct X-Received: by 10.101.82.138 with SMTP id y10mr3851742pgp.343.1523243364070; Sun, 08 Apr 2018 20:09:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243364; cv=none; d=google.com; s=arc-20160816; b=CZK/gb/pcyhJaw+9OwnbkFcMzGwlOG9NSIYd5y/V9OG0621MI+OGFgFi2IxYMeWPyH EgiOEx+Q/XX7b2syKgl6fGxn7Nl38ehpQqOQQ9rTR8y6tUXqSJSvyGo8Dpjp6tXGGB5N bWkE3ASBYbCq9xuucnufpSw3WcM2ZSpV80h+OTSF2aVKzCTF053V6NSNHQDgf2bZzEkg 4B80h4zR1Dnm0GI5Dpb/o9vKge9HPgmSCRVfvACA13eRI3Z4j3moS+objuVIHsTJDj+q 0+4ZEj2RUGNN8QvE+ysy7qOB2O6LFgW+s4sKpHLKoHZqw2X3jxRQC6TYw9mvmqEgY3yJ IfWQ== 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=cXDy8JzI18dDdE+npK9vSXXvDZqdIaRKIV/C688Pfvk=; b=u/ueSI3jgos36+Q5FH3499BkV9BOGiGzidEcNM2Nkij8Jkf49AZwT2IU37I/oHvKB2 qyJeITQsQV7uN7KFhuPidw6v502iGqI0IaD8IuGgAn8YRTEIBf44New2nqiSkV9M6Mew Pf9SFfA8T2shH3UeEw+6tB5IJ9YLjHsPED7VNuZA1EAYTbkjHeo/R6GpheewArF0orjY MyHpf59AjmqPfEwX/Ro87h71TZic7QCTiNY/R5Yh2x9Jakac7b/feSX9JIT0BivJsRo6 B/qu0iLLWAW+XxYo+Mgy2JjivRGkdPnmzJj5gezgSdlmxiffwSc8fA6b3L7XWqGwtrvs +LYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=YGyAeaKb; 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 f64-v6si13703014plf.624.2018.04.08.20.08.47; Sun, 08 Apr 2018 20:09:24 -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=YGyAeaKb; 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 S932252AbeDICas (ORCPT + 99 others); Sun, 8 Apr 2018 22:30:48 -0400 Received: from mail-bn3nam01on0096.outbound.protection.outlook.com ([104.47.33.96]:38912 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755843AbeDIA2c (ORCPT ); Sun, 8 Apr 2018 20:28:32 -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=cXDy8JzI18dDdE+npK9vSXXvDZqdIaRKIV/C688Pfvk=; b=YGyAeaKbJmcC9aF1/W82GoNfckpryJtiUV7Lh4fGc9fCFI5iaEeI9bV4Py+nxcXoLotYHvA5Q7HmsrhE/oXIZXQodKdlwL4uBfwcVUKLeX/7bZtXI6FbHJvxvcmxRVp5VZ1l5aSx+IJCIcRHZPf/LjdaMp3gdlwAt1y6qLZRuP8= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0807.namprd21.prod.outlook.com (10.167.110.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.3; Mon, 9 Apr 2018 00:28:28 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:28:28 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Raju Rangoju , Doug Ledford , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 075/293] rdma/cxgb4: Fix memory leaks during module exit Thread-Topic: [PATCH AUTOSEL for 4.9 075/293] rdma/cxgb4: Fix memory leaks during module exit Thread-Index: AQHTz5kJCYZhJynaSEScsPhT89oelg== Date: Mon, 9 Apr 2018 00:23:52 +0000 Message-ID: <20180409002239.163177-75-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-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;DM5PR2101MB0807;7:X3Ljka9gpblqVTPQeWPlCTO2EuTKnT+JD+cq2xj+aWQkeKGA7san97GsBU7P0HifiE65S9bwbZ3hthQ26Tj5rQDy5PSnMuAdjWrEcjl5+Hu8XyUFa4pzF0yHWxoA1CkJ3mNFPZlpREtmvVOND7LErKf1uNRWTh2DA9xuFETJUSVSiwc4J7O08kD1jtrhQc9zasFo1O4MiTfJJPWanJEgoNjgchUw2A5jwWEz/S2iNlslQnvO8+kE7/20RokmrKli;20:5tY45yHZ4TrDMAZ806I46V5rhj815rKfbfVlUw10SkpnGooKLk+7as5hu2MEMypA/xE3oWf6gEuJ3/bOp4eVZdAOqfaNntlMxNko1uR4fwgT20efW1InYwNegYYYDrPyjUTFoQTmpJHx5T6+ti16MV0k7aTZCRB0SCOXN+QcApk= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 91270810-6a0e-4bfc-bb94-08d59db0d0ad x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0807; x-ms-traffictypediagnostic: DM5PR2101MB0807: 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); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3231221)(944501327)(52105095)(3002001)(6055026)(61426038)(61427038)(6041310)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR2101MB0807;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0807; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39380400002)(39860400002)(396003)(366004)(376002)(346002)(199004)(189003)(14454004)(4326008)(54906003)(25786009)(53936002)(2900100001)(1076002)(3280700002)(6486002)(186003)(2616005)(68736007)(110136005)(11346002)(10090500001)(6116002)(107886003)(3846002)(36756003)(8676002)(72206003)(22452003)(66066001)(26005)(6512007)(478600001)(3660700001)(81156014)(86362001)(81166006)(86612001)(7736002)(305945005)(8936002)(10290500003)(6436002)(105586002)(6666003)(316002)(59450400001)(76176011)(5660300001)(476003)(106356001)(2906002)(6506007)(446003)(2501003)(99286004)(5250100002)(486006)(102836004)(97736004)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0807;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: ydLt3kmDEclXNwm97FE0EJb82bFNJdmkwzy56IyKMyN70DlTY1PR1o2ZStsn7iA3WllQPx/lnReOuS29E7Ou4vq4dE+0VUG45CyshCCrwU+hA7RkX3z+j7m0rzqZCz2oNNXtQUzlw88YZTY341OS4ZYt9POL8qZU4zeqd1ouZGLeiwSk6/Tcr4L5UGGtQ9XC24rebYbr8vqJTH4ENrZlGJJYIHcPKzoxEn3UNLiLoC5nT2UQ0DJtGpeH/GhcotqT0fQzw7HkyF06Ulkjz6oNOWPdAr5mQzE6GQNigCj8vgp2VnXZvs5OQZBKseDQdtN3g8flGz80cxW1BqfenY/thZ/A9pn2AMNX4iCD85Vmyo6Hu53aJ7q0VSUeJ4Lv3xkKG5qhZlDA6n6YXNG+xEoeviPX8wv9Eo7mOdd0OdK9tTU= 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: 91270810-6a0e-4bfc-bb94-08d59db0d0ad X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:23:52.7843 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0807 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Raju Rangoju [ Upstream commit d4702645838c8e04893383b50406249382b4e6bf ] Fix memory leaks of iw_cxgb4 module in the exit path Signed-off-by: Raju Rangoju Reviewed-by: Steve Wise Signed-off-by: Doug Ledford Signed-off-by: Sasha Levin --- drivers/infiniband/hw/cxgb4/device.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/c= xgb4/device.c index b85a1a983e07..feb30db3ce3b 100644 --- a/drivers/infiniband/hw/cxgb4/device.c +++ b/drivers/infiniband/hw/cxgb4/device.c @@ -732,7 +732,7 @@ void c4iw_release_dev_ucontext(struct c4iw_rdev *rdev, kfree(entry); } =20 - list_for_each_safe(pos, nxt, &uctx->qpids) { + list_for_each_safe(pos, nxt, &uctx->cqids) { entry =3D list_entry(pos, struct c4iw_qid_list, entry); list_del_init(&entry->entry); kfree(entry); @@ -851,13 +851,15 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev) rdev->free_workq =3D create_singlethread_workqueue("iw_cxgb4_free"); if (!rdev->free_workq) { err =3D -ENOMEM; - goto err_free_status_page; + goto err_free_status_page_and_wr_log; } =20 rdev->status_page->db_off =3D 0; =20 return 0; -err_free_status_page: +err_free_status_page_and_wr_log: + if (c4iw_wr_log && rdev->wr_log) + kfree(rdev->wr_log); free_page((unsigned long)rdev->status_page); destroy_ocqp_pool: c4iw_ocqp_pool_destroy(rdev); @@ -874,9 +876,11 @@ static void c4iw_rdev_close(struct c4iw_rdev *rdev) { destroy_workqueue(rdev->free_workq); kfree(rdev->wr_log); + c4iw_release_dev_ucontext(rdev, &rdev->uctx); free_page((unsigned long)rdev->status_page); c4iw_pblpool_destroy(rdev); c4iw_rqtpool_destroy(rdev); + c4iw_ocqp_pool_destroy(rdev); c4iw_destroy_resource(&rdev->resource); } =20 --=20 2.15.1