| From b896c15c19699f8f461f06856748b8a64ced3c88 Mon Sep 17 00:00:00 2001 |
| From: Pan Zhang <zhangpan26@huawei.com> |
| Date: Thu, 19 Dec 2019 10:45:30 +0800 |
| Subject: [PATCH] drivers/hid/hid-multitouch.c: fix a possible null pointer |
| access. |
| |
| commit 306d5acbfc66e7cccb4d8f91fc857206b8df80d1 upstream. |
| |
| 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: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c |
| index 4c6693b4e562..72e928177e6b 100644 |
| --- a/drivers/hid/hid-multitouch.c |
| +++ b/drivers/hid/hid-multitouch.c |
| @@ -1003,7 +1003,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 |
| -- |
| 2.7.4 |
| |