]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.4.157/misc-ti-st-fix-memory-leak-in-the-error-path-of-probe.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.4.157 / misc-ti-st-fix-memory-leak-in-the-error-path-of-probe.patch
CommitLineData
7be860c4
GKH
1From foo@baz Mon Sep 17 12:15:09 CEST 2018
2From: Anton Vasilyev <vasilyev@ispras.ru>
3Date: Fri, 27 Jul 2018 18:45:36 +0300
4Subject: misc: ti-st: Fix memory leak in the error path of probe()
5
6From: Anton Vasilyev <vasilyev@ispras.ru>
7
8[ Upstream commit 81ae962d7f180c0092859440c82996cccb254976 ]
9
10Free resources instead of direct return of the error code if kim_probe
11fails.
12
13Found by Linux Driver Verification project (linuxtesting.org).
14
15Signed-off-by: Anton Vasilyev <vasilyev@ispras.ru>
16Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
17Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
18Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19---
20 drivers/misc/ti-st/st_kim.c | 4 ++--
21 1 file changed, 2 insertions(+), 2 deletions(-)
22
23--- a/drivers/misc/ti-st/st_kim.c
24+++ b/drivers/misc/ti-st/st_kim.c
25@@ -757,14 +757,14 @@ static int kim_probe(struct platform_dev
26 err = gpio_request(kim_gdata->nshutdown, "kim");
27 if (unlikely(err)) {
28 pr_err(" gpio %d request failed ", kim_gdata->nshutdown);
29- return err;
30+ goto err_sysfs_group;
31 }
32
33 /* Configure nShutdown GPIO as output=0 */
34 err = gpio_direction_output(kim_gdata->nshutdown, 0);
35 if (unlikely(err)) {
36 pr_err(" unable to configure gpio %d", kim_gdata->nshutdown);
37- return err;
38+ goto err_sysfs_group;
39 }
40 /* get reference of pdev for request_firmware
41 */