]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.14.34/scsi-libsas-fix-memory-leak-in-sas_smp_get_phy_events.patch
Linux 4.14.95
[thirdparty/kernel/stable-queue.git] / releases / 4.14.34 / scsi-libsas-fix-memory-leak-in-sas_smp_get_phy_events.patch
CommitLineData
df1b7722
GKH
1From foo@baz Mon Apr 9 13:58:16 CEST 2018
2From: Jason Yan <yanaijie@huawei.com>
3Date: Thu, 4 Jan 2018 21:04:31 +0800
4Subject: scsi: libsas: fix memory leak in sas_smp_get_phy_events()
5
6From: Jason Yan <yanaijie@huawei.com>
7
8
9[ Upstream commit 4a491b1ab11ca0556d2fda1ff1301e862a2d44c4 ]
10
11We've got a memory leak with the following producer:
12
13while true;
14do cat /sys/class/sas_phy/phy-1:0:12/invalid_dword_count >/dev/null;
15done
16
17The buffer req is allocated and not freed after we return. Fix it.
18
19Fixes: 2908d778ab3e ("[SCSI] aic94xx: new driver")
20Signed-off-by: Jason Yan <yanaijie@huawei.com>
21CC: John Garry <john.garry@huawei.com>
22CC: chenqilin <chenqilin2@huawei.com>
23CC: chenxiang <chenxiang66@hisilicon.com>
24Reviewed-by: Christoph Hellwig <hch@lst.de>
25Reviewed-by: Hannes Reinecke <hare@suse.com>
26Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
27Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
28Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
29---
30 drivers/scsi/libsas/sas_expander.c | 1 +
31 1 file changed, 1 insertion(+)
32
33--- a/drivers/scsi/libsas/sas_expander.c
34+++ b/drivers/scsi/libsas/sas_expander.c
35@@ -695,6 +695,7 @@ int sas_smp_get_phy_events(struct sas_ph
36 phy->phy_reset_problem_count = scsi_to_u32(&resp[24]);
37
38 out:
39+ kfree(req);
40 kfree(resp);
41 return res;
42