Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2353271imm; Thu, 7 Jun 2018 09:13:48 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKzRawKv15vum8nE0+ydYQv68Pnjln3l56mqBBvNt1EoOQgME+5nVgRLo0ChPf9UJNXDVRs X-Received: by 2002:a63:9702:: with SMTP id n2-v6mr2099757pge.88.1528388028270; Thu, 07 Jun 2018 09:13:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528388028; cv=none; d=google.com; s=arc-20160816; b=bx1uyO60+kV0Suc0BcZLTxWlxxdM2AY1k2Y7c5jItnfDCdVSHiovaBrkz+jhhD4HfA zgV9OPwSahs1lBu9JjuysiUuMOyP/uHfNakinzfk/KoX27iEz7vrp6ShITF+ALosvH/K WqFRSYGneYjN8/02443yB14xuucMiKqP5joHI+jOFJUF6riV2hMm9/pcv0EX53flVv/Q FsyilhWMDyjZTwUytI1oqH/2aRogBttlgceoKo7keRsC5q6fFQGrj9elB02FOncml1KL BcwedUw/FuPxJ4KXXIItN7sMVDvZqvjmeleleOBiyDbc9uIi7/4O9JQyu5rJ6/4b90PA xVPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=z5wNYLePmazkeQQ7bWWmuH09rYn1ZLldruk1MoCkR6M=; b=uTIB+5cqJBxQ06m4+ZH7k/74wNR7BPUx1pqb5SxYPwaI435lVwdPeObl6kjHhatnDo yH5fmzlIr0Wn+O8uCnWZx6uGQ1Sq6bSjYKDFxusjY0w3B0Gp087VwMyN+F2fa+FG+T8E W0jwH9Z6UULLweofn6Nfw0pm6gxhOwF7i0sdGF7bT+a3oxjBhvUn1IMEHMKl3Ut9LZdW FZMj4xvyBzC8u1oob2/wNP93ZzJ2jw66eVcBp0J6fzDca4w5RrzhumNppSlmGL0b90Iu PgF6sS0fkpgX7ITymSuE5Dt+8bmXd4BGo+KrgT4l1Jf8uKrJ955yzgkwFbni6rnLY89I L6Zw== 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 a5-v6si5502245pgu.119.2018.06.07.09.13.34; Thu, 07 Jun 2018 09:13:48 -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 S935882AbeFGQKs (ORCPT + 99 others); Thu, 7 Jun 2018 12:10:48 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:39183 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932928AbeFGOJB (ORCPT ); Thu, 7 Jun 2018 10:09:01 -0400 Received: from [148.252.241.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1fQvb1-0005Zu-HT; Thu, 07 Jun 2018 15:08:59 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1fQvax-0002iM-VO; Thu, 07 Jun 2018 15:08:55 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Jason Yan" , "chenxiang" , "John Garry" , "Hannes Reinecke" , "Christoph Hellwig" , "chenqilin" , "Martin K. Petersen" Date: Thu, 07 Jun 2018 15:05:21 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 029/410] scsi: libsas: fix memory leak in sas_smp_get_phy_events() In-Reply-To: X-SA-Exim-Connect-IP: 148.252.241.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.57-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Jason Yan commit 4a491b1ab11ca0556d2fda1ff1301e862a2d44c4 upstream. 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: Ben Hutchings --- 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;