Input: cyttsp4_core - fix use after free bug
authorPan Bian <bianpan2016@163.com>
Wed, 13 Nov 2019 01:04:54 +0000 (17:04 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 21 Dec 2019 09:40:48 +0000 (10:40 +0100)
commitad4784e67c8969d214da6ae2d2e6a3790178d50e
treee9bc2ce9dcf97f1bc43937a8a23072339b028c02
parentb597aa928209e4c183e671a5cd078ec3ea262be3
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>
drivers/input/touchscreen/cyttsp4_core.c