Received: by 10.192.165.156 with SMTP id m28csp64828imm; Tue, 10 Apr 2018 16:30:24 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/dkZJZWe6Utd2i+f945sECx0pXNuRnJ9/Y1UZcgnflUtd0Q1jTJKkLi4YOcZ3/87gkFN23 X-Received: by 2002:a17:902:564:: with SMTP id 91-v6mr2511943plf.63.1523403024266; Tue, 10 Apr 2018 16:30:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523403024; cv=none; d=google.com; s=arc-20160816; b=fVygMSHXWMiwicAbEO/8npY7P4SEoOEZIwVg9ynwObqayRZXqolA44jvLZgbszFhpp trMnEVivxk0vvzEjzL6WJ4juwNXZEgmIHcvmegRBhzJSY85yTTFO00hFFgYV4r5gSxR3 a2hZfFtAomh52nfrezkPpvL/Q9Z56/lKxhrSRCKtNvvyJQKVQ6+GcU+xSSl+6jHKJS7n I/CJvQ/uDJdf2Jt32DsIbG2VMba9BixD1DHAqO0JzHczjWZMRnnR5sp3D1R3F2HI7Zh6 hhMnhCJj/6DzDHpwTyaOFS6IY7AjlsSPffwnVIa/21trVzn3dQCFpZlvo4/6UtSVBgwT OrjA== 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=NXUBaGSHg6DPxKhXlntqnHz9CQmfGcc11UUYC0e5rVU=; b=OH32SYMfwEzx7dH3MvIL42db7bmKew8/JmAUmxbDf9BS/bap6NdkXrp/Jp4X+neBmg st7ngEYLOwFAHDNgn/InAxpDB1TIE7mbArKLNK5OS7RGfl7DImycIB//U6GpHeJdIj4A fRxtic6+wWmYA89ToZwOi/I24wn7+kQRl7JB8ztd8WX8b/HZZ7s+4ckRTQAyu4qHvPXz NtBcXV56rTbYjt0xcqq94fOQvESrsZAmwv8KucNrCmTIEhjFupSb1CW+JdiyJK81wQon 9JL3DGx9hzZ5LAa2xtlAonLrZBWH5bNCSvXDw4cnWppYCFx5d3oKzty00r9nbUZd2IqG CSIA== 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 h15-v6si3868960plk.535.2018.04.10.16.29.47; Tue, 10 Apr 2018 16:30: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; 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 S1754501AbeDJWaL (ORCPT + 99 others); Tue, 10 Apr 2018 18:30:11 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:39852 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754428AbeDJWaH (ORCPT ); Tue, 10 Apr 2018 18:30: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 D3190DC3; Tue, 10 Apr 2018 22:30:06 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jason Yan , John Garry , chenqilin , chenxiang , Christoph Hellwig , Hannes Reinecke , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.15 077/168] scsi: libsas: fix memory leak in sas_smp_get_phy_events() Date: Wed, 11 Apr 2018 00:23:39 +0200 Message-Id: <20180410212803.555086065@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: 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 Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/libsas/sas_expander.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c @@ -695,6 +695,7 @@ int sas_smp_get_phy_events(struct sas_ph phy->phy_reset_problem_count = scsi_to_u32(&resp[24]); out: + kfree(req); kfree(resp); return res;