summaryrefslogtreecommitdiff
path: root/drivers/hid
diff options
context:
space:
mode:
authorPan Zhang <zhangpan26@huawei.com>2019-12-19 05:45:30 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-02-01 12:37:07 +0300
commit7be469aa4379e17de7c9f73bed7ca8f2989b60cd (patch)
tree1bd5e8221457c6e3a8e6c9e557ede4ecafd222d5 /drivers/hid
parent1bc5791675a1147c5d964b3157e078f013107a04 (diff)
downloadlinux-7be469aa4379e17de7c9f73bed7ca8f2989b60cd.tar.xz
drivers/hid/hid-multitouch.c: fix a possible null pointer access.
[ Upstream commit 306d5acbfc66e7cccb4d8f91fc857206b8df80d1 ] 1002 if ((quirks & MT_QUIRK_IGNORE_DUPLICATES) && mt) { 1003 struct input_mt_slot *i_slot = &mt->slots[slotnum]; 1004 1005 if (input_mt_is_active(i_slot) && 1006 input_mt_is_used(mt, i_slot)) 1007 return -EAGAIN; 1008 } We previously assumed 'mt' could be null (see line 1002). The following situation is similar, so add a judgement. Signed-off-by: Pan Zhang <zhangpan26@huawei.com> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-multitouch.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 8403251992ab..19dfd8acd0da 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -1007,7 +1007,7 @@ static int mt_process_slot(struct mt_device *td, struct input_dev *input,
tool = MT_TOOL_DIAL;
else if (unlikely(!confidence_state)) {
tool = MT_TOOL_PALM;
- if (!active &&
+ if (!active && mt &&
input_mt_is_active(&mt->slots[slotnum])) {
/*
* The non-confidence was reported for