Received: by 10.213.65.68 with SMTP id h4csp1663059imn; Mon, 19 Mar 2018 09:59:54 -0700 (PDT) X-Google-Smtp-Source: AG47ELuWrP0mYFsmf4hO7L9A0rlJ01TG6ezXuUWgpCywnbp1O/U0Si/1NKKUWbOf+z5f95q+fkUu X-Received: by 10.101.101.133 with SMTP id u5mr9554029pgv.151.1521478794384; Mon, 19 Mar 2018 09:59:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521478794; cv=none; d=google.com; s=arc-20160816; b=Tso4S6BeTW86vBaHy0e0HG1wQevkbI9BtrgHShWcpW5ksevcWPy4GX5IX2k2NYw8y2 I3pLPXruDzgf81I2x4GVaHblA+x9fpjIrQZDkeXMTMgl8juSBu4mC4aczX6/R5EPpWUz hwDK2FnirM69RLCc4gII+ed1p1BCNfna5ma+py1p7kZRbq5/BZOwidwvPCdJsz3IP7Re wfEvjbu6eOtHRIG4x83RaCppddQmu3/mACGtjhKT7NPAz4gLwtOoSbAd86sQenuA1NO3 8nXr8zr6BFMtoQVWtxOwqAkKCUI63/Dz4Q9snR/X48iW+bNJPJ3WOU6alWNu5QtySXd1 JTLA== 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=Rma6asf7JMPVGJCV9DU8eDw00uNKBjVRyB14AuvEmGQ=; b=NoiYtFJVZ60ee7rYGD3759d64GjdwXXPY5GDmtWaidjUaF+AHMD+jlG0soexmiun85 ZC9vpPX13mG7VTVJIGMSoYDk8asCgO/IinbHxKSHqwNzs7VO74eQYsKwhgrdSBc68izT 6twYGiE4CQWbBOmoaeOjKTHQHXo+K2VxCInwniQpjs1KRVwkrAg3xaNClzdJC7P3Qd2q Go5QasTHQXIS5fBM13eOhrkW0cXLE9BQy0lN7A0VSQxNAefyCvlSTfo+UOfiuzoEttGB Z2hEso5CEu/mjEsB97DgQbbEtkzTPk2ZvYWy2Q92A+B2dszuenPMxkwbfM2V9N2oJxo2 9CYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=IQQFG9BE; 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 p3si212672pgr.782.2018.03.19.09.59.39; Mon, 19 Mar 2018 09:59:54 -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=IQQFG9BE; 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 S967606AbeCSQ4S (ORCPT + 99 others); Mon, 19 Mar 2018 12:56:18 -0400 Received: from mail-dm3nam03on0108.outbound.protection.outlook.com ([104.47.41.108]:23560 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S966536AbeCSQLe (ORCPT ); Mon, 19 Mar 2018 12:11:34 -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=Rma6asf7JMPVGJCV9DU8eDw00uNKBjVRyB14AuvEmGQ=; b=IQQFG9BEfDp/XxEoMbrcSyzz02EBneHQnaotbQG2TWvT9KtGIH8JkIvRsk57k/QyE7g4rdzKvwPQYY7fq1ftFi9N1/vyeqgEKZ+yRJ+N36MBCSmw3BMZbeacJe9WGGK8NkaVqvjxuoF3icQsk8Rhx/nmvgEuztEIHAJrNR6MCOs= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0984.namprd21.prod.outlook.com (52.132.133.30) 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 16:11:23 +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 16:11:23 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Jason Yan , John Garry , chenqilin , chenxiang , "Martin K . Petersen" , Sasha Levin Subject: [PATCH AUTOSEL for 4.4 156/167] scsi: libsas: fix memory leak in sas_smp_get_phy_events() Thread-Topic: [PATCH AUTOSEL for 4.4 156/167] scsi: libsas: fix memory leak in sas_smp_get_phy_events() Thread-Index: AQHTv5yK/Q2B53uN0UmAsm3MLnxxKA== Date: Mon, 19 Mar 2018 16:08:38 +0000 Message-ID: <20180319160513.16384-156-alexander.levin@microsoft.com> References: <20180319160513.16384-1-alexander.levin@microsoft.com> In-Reply-To: <20180319160513.16384-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;DM5PR2101MB0984;7:Tp8f7meZnSjwkPcjJLuxRnwLtC/MUkq6ehQ7RH8NaiMR6v71s50sbxyVJmzNvxLT1YpYFtx2XU6hb8JArluoKBzGI+0krVA/uIFqza2/3mOQL38hl/g6h3m6bg/vJlPO/7xe2GVdGhXGsRFk1wZkJB425AYvNl6ZAIIhszaeoUZCkv65tEoUievhtyP1mfkAOiOr5TMHYQa4KXFJZc0g/UEM+Ag/m4JEhD6aGME6G31Q9F2yta33utkmoHT5fb47;20:xaViO62J4D4phxJtVnwuWhrLMqB8yloLOfkjZPSY3FyPvyeaxGPzcWAzni3LSEvS9ThHdOut3N8y70POrysmvWX8bKvXjymaklsAiV2rCjnK87+ovDj/+yWrp2diNFFPYwwTsZ8SWaiadAdemT+PhIwHCBb7qeqYX091GwKw7MU= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: bef06c90-762d-408e-638e-08d58db40f6a x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0984; x-ms-traffictypediagnostic: DM5PR2101MB0984: 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)(146099531331640); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501300)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011);SRVR:DM5PR2101MB0984;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0984; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(39860400002)(366004)(39380400002)(376002)(346002)(199004)(189003)(54906003)(14454004)(68736007)(10090500001)(5660300001)(6506007)(186003)(26005)(99286004)(7736002)(305945005)(76176011)(316002)(22452003)(53936002)(102836004)(110136005)(2906002)(107886003)(86362001)(10290500003)(3280700002)(478600001)(3660700001)(72206003)(86612001)(6512007)(3846002)(66066001)(36756003)(97736004)(6116002)(6486002)(25786009)(6666003)(2950100002)(1076002)(4326008)(5250100002)(105586002)(2900100001)(2501003)(81166006)(8936002)(81156014)(6436002)(8676002)(106356001)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0984;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: /+RNzp7LbD0/7t7/NLcISPNRRRIZqfJs8DnKFt9OI+tuTXbHefH2lS5b8U5NjBoKok4GWs6AZKA3YB4giGwNZN1wC/t3wsQ7tZ4AnJVKhRK5gzeuKnPJWK63aa+FIUc6i3+PH33f0uI2eu4DkvmbMU/I77YyTlbWjNmDEmHlKnGVNGbMDS507VyLRG4xdroITPmv7H+l1FsIDQRciUB7gyLyj/IezDqoh3P2h4Gep2jQN2z6N2je+WOeIJjxewBpw/LAqlvCf/4526N7eI/Opu3HFFLjs/gLw09laqvUipPxvW9vKyjXj9JyFprybJTu+YZ3lJRr4bLTq4IcQrPAjQ== 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: bef06c90-762d-408e-638e-08d58db40f6a X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 16:08:38.2682 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0984 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jason Yan [ Upstream commit 4a491b1ab11ca0556d2fda1ff1301e862a2d44c4 ] We've got a memory leak with the following producer: while true; do cat /sys/class/sas_phy/phy-1:0:12/invalid_dword_count >/dev/null; done The buffer req is allocated and not freed after we return. Fix it. Fixes: 2908d778ab3e ("[SCSI] aic94xx: new driver") Signed-off-by: Jason Yan CC: John Garry CC: chenqilin CC: chenxiang Reviewed-by: Christoph Hellwig Reviewed-by: Hannes Reinecke Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/libsas/sas_expander.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_e= xpander.c index 022bb6e10d98..76730a5637ca 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c @@ -684,6 +684,7 @@ int sas_smp_get_phy_events(struct sas_phy *phy) phy->phy_reset_problem_count =3D scsi_to_u32(&resp[24]); =20 out: + kfree(req); kfree(resp); return res; =20 --=20 2.14.1