summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPan Bian <bianpan2016@163.com>2019-11-12 17:04:54 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-12-13 08:48:35 +0100
commit47c7888200bcb909b673bf080d52c05c90e4320d (patch)
tree41c4d624536a8d8098ebe8c438d0519a53093a8e
parentbc6024b4273dcb39eebc0fc26de164185d1933cd (diff)
downloadlinux-stable-47c7888200bcb909b673bf080d52c05c90e4320d.tar.gz
linux-stable-47c7888200bcb909b673bf080d52c05c90e4320d.tar.bz2
linux-stable-47c7888200bcb909b673bf080d52c05c90e4320d.zip
Input: cyttsp4_core - fix use after free bug
[ Upstream commit 79aae6acbef16f720a7949f8fc6ac69816c79d62 ] The device md->input is used after it is released. Setting the device data to NULL is unnecessary as the device is never used again. Instead, md->input should be assigned NULL to avoid accessing the freed memory accidently. Besides, checking md->si against NULL is superfluous as it points to a variable address, which cannot be NULL. Signed-off-by: Pan Bian <bianpan2016@163.com> Link: https://lore.kernel.org/r/1572936379-6423-1-git-send-email-bianpan2016@163.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/input/touchscreen/cyttsp4_core.c7
1 files changed, 0 insertions, 7 deletions
diff --git a/drivers/input/touchscreen/cyttsp4_core.c b/drivers/input/touchscreen/cyttsp4_core.c
index 4b22d49a0f49..6bcffc930384 100644
--- a/drivers/input/touchscreen/cyttsp4_core.c
+++ b/drivers/input/touchscreen/cyttsp4_core.c
@@ -1990,11 +1990,6 @@ static int cyttsp4_mt_probe(struct cyttsp4 *cd)
/* get sysinfo */
md->si = &cd->sysinfo;
- if (!md->si) {
- dev_err(dev, "%s: Fail get sysinfo pointer from core p=%p\n",
- __func__, md->si);
- goto error_get_sysinfo;
- }
rc = cyttsp4_setup_input_device(cd);
if (rc)
@@ -2004,8 +1999,6 @@ static int cyttsp4_mt_probe(struct cyttsp4 *cd)
error_init_input:
input_free_device(md->input);
-error_get_sysinfo:
- input_set_drvdata(md->input, NULL);
error_alloc_failed:
dev_err(dev, "%s failed.\n", __func__);
return rc;