Commit 79aae6ac authored by Pan Bian's avatar Pan Bian Committed by Dmitry Torokhov

Input: cyttsp4_core - fix use after free bug

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: default avatarPan Bian <bianpan2016@163.com>
Link: https://lore.kernel.org/r/1572936379-6423-1-git-send-email-bianpan2016@163.comSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 549766ac
...@@ -1990,11 +1990,6 @@ static int cyttsp4_mt_probe(struct cyttsp4 *cd) ...@@ -1990,11 +1990,6 @@ static int cyttsp4_mt_probe(struct cyttsp4 *cd)
/* get sysinfo */ /* get sysinfo */
md->si = &cd->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); rc = cyttsp4_setup_input_device(cd);
if (rc) if (rc)
...@@ -2004,8 +1999,6 @@ static int cyttsp4_mt_probe(struct cyttsp4 *cd) ...@@ -2004,8 +1999,6 @@ static int cyttsp4_mt_probe(struct cyttsp4 *cd)
error_init_input: error_init_input:
input_free_device(md->input); input_free_device(md->input);
error_get_sysinfo:
input_set_drvdata(md->input, NULL);
error_alloc_failed: error_alloc_failed:
dev_err(dev, "%s failed.\n", __func__); dev_err(dev, "%s failed.\n", __func__);
return rc; return rc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment