Received: by 10.192.165.156 with SMTP id m28csp1159525imm; Wed, 11 Apr 2018 13:34:40 -0700 (PDT) X-Google-Smtp-Source: AIpwx486oUE/WpJeuIyRrf593uAMUukCCdNndofAyJtZzb+O94DfT2kQkc15aqXPG5bLJPT3B3+h X-Received: by 10.98.36.76 with SMTP id r73mr5276188pfj.108.1523478880115; Wed, 11 Apr 2018 13:34:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523478880; cv=none; d=google.com; s=arc-20160816; b=0WQ42CiaOMz8lbJVD0ezuC+/KaJ9KNRrvlyTgMRMdza4gY6XmGT0IghfmA5GfvbTBX 8ibaa6JcmA5g1TWPe4KCrvH1aQvLba1N4+EEUYB80yFALC8YVl3mGvFQejyFJ71FwNuM JxxYKRVg5IXdodrlw9OlByStPgYkWcDyC1ApmiaYGGqfdfEr6vvP8Z647fRkEVNkypfy SxA1xAhAOu/aD1N8GIUMZLRFMRym9NS3vqQvM5yKxi5ZA7zj9cUDMJxiYRJQplan1afr 8p153yef34LKJjPkHNK7yRGhSPOHIKFRID76npJEo609AMnjnxv0dMc+fjO6IB/tQeHm KifQ== 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=pxmP/gD5EXH4LfMBDfWUq8fGU/mxcVirWQUlF7Sfwb4=; b=eysNBoyqIjwi1zQB3bUt2E6YXWH6IfPL4VkIpaWFpQRTejrSgLhVrwMNeejn02sIti SIdL4di0nlv0RRe5Ozce488B50yaAxR2V7RvG4lQgG9A7T/iuYcBDW/D596w6oFdQ5Uc JmlABHVeqSHgEa70A/468LWESdWiwuoG3WMxee2fvqVDO1pjDSPumapfnlTXbU43D/lG LHPIOkHfx9niDWcFI5lvYABwJEdFTspuq+cLoajAyEAwIeV7z0n22phYMUTOfjZpnNRq CsbC7y1IzquP+EBiqjhr5H5ylRTwPI+dqoDXkJWwk5OhOGn7BpNdjVwUGMxNYI1ByNF3 8fGg== 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 s10si1240267pge.41.2018.04.11.13.34.03; Wed, 11 Apr 2018 13:34:40 -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 S1757083AbeDKU3L (ORCPT + 99 others); Wed, 11 Apr 2018 16:29:11 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60734 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932599AbeDKSuS (ORCPT ); Wed, 11 Apr 2018 14:50:18 -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 CA05FD23; Wed, 11 Apr 2018 18:50:17 +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.4 151/190] scsi: libsas: fix memory leak in sas_smp_get_phy_events() Date: Wed, 11 Apr 2018 20:36:37 +0200 Message-Id: <20180411183601.450144801@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183550.114495991@linuxfoundation.org> References: <20180411183550.114495991@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.4-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 @@ -684,6 +684,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;