Skip to content

Commit 79aae6a

Browse files
SinkFinderdtor
authored andcommitted
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: Pan Bian <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 549766a commit 79aae6a

File tree

1 file changed

+0
-7
lines changed

1 file changed

+0
-7
lines changed

drivers/input/touchscreen/cyttsp4_core.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1990,11 +1990,6 @@ static int cyttsp4_mt_probe(struct cyttsp4 *cd)
19901990

19911991
/* get sysinfo */
19921992
md->si = &cd->sysinfo;
1993-
if (!md->si) {
1994-
dev_err(dev, "%s: Fail get sysinfo pointer from core p=%p\n",
1995-
__func__, md->si);
1996-
goto error_get_sysinfo;
1997-
}
19981993

19991994
rc = cyttsp4_setup_input_device(cd);
20001995
if (rc)
@@ -2004,8 +1999,6 @@ static int cyttsp4_mt_probe(struct cyttsp4 *cd)
20041999

20052000
error_init_input:
20062001
input_free_device(md->input);
2007-
error_get_sysinfo:
2008-
input_set_drvdata(md->input, NULL);
20092002
error_alloc_failed:
20102003
dev_err(dev, "%s failed.\n", __func__);
20112004
return rc;

0 commit comments

Comments
 (0)