From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0B38C35242 for ; Fri, 24 Jan 2020 01:18:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AAF0F2253D for ; Fri, 24 Jan 2020 01:18:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579828683; bh=jMpYoVKZZmhxfblWsVYFG09q0ERX0bmgtj5z33SF3hY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=FYCr7n7+TKxhr3lQxHd53PWE9C7gEAS+NFfO98t9LWE5h3bf1fvIT4hSpnSykPu9d 9X3NMym0CmA/n1gLn+BSm4i98fG4tVdkpKmf0bCSGL00Ua0ByuNTtGiiu3RE06q/RP 6aLlQyCG9KD0p0gN/7MsJ8wTB+jNySo5SYe4LvlU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730909AbgAXBSC (ORCPT ); Thu, 23 Jan 2020 20:18:02 -0500 Received: from mail.kernel.org ([198.145.29.99]:33158 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730879AbgAXBSB (ORCPT ); Thu, 23 Jan 2020 20:18:01 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EE0FE24655; Fri, 24 Jan 2020 01:17:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579828680; bh=jMpYoVKZZmhxfblWsVYFG09q0ERX0bmgtj5z33SF3hY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yjYCPlUarSMF6ha7/j8mr0TkZFRk5EI0E70JAKw2EaDPJyZZdqY8/NLB9/6ZftaJp dDpXP11pGOI8HctoILzVLQwZhEp0UUSbhrFqsDP3ntS5kqgEL+EmebX7kuDyFT3ykT PHiQvQhaq0cuGok2579FpJMqTcBJFtNiOKRlS8yM= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Pan Zhang , Benjamin Tissoires , Sasha Levin , linux-input@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 11/11] drivers/hid/hid-multitouch.c: fix a possible null pointer access. Date: Thu, 23 Jan 2020 20:17:47 -0500 Message-Id: <20200124011747.18575-11-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200124011747.18575-1-sashal@kernel.org> References: <20200124011747.18575-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Pan Zhang [ 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 Signed-off-by: Benjamin Tissoires Signed-off-by: Sasha Levin --- drivers/hid/hid-multitouch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index f9167d0e095ce..4a1e13ec7e7f0 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 -- 2.20.1