Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1367635ybj; Thu, 7 May 2020 23:00:45 -0700 (PDT) X-Google-Smtp-Source: APiQypJyHJ4yLyJiOXUCdEPGU5dJuUfngA+khwPoXBAwOtq4fu2okLZf8Sc0vn43953inK94x4YK X-Received: by 2002:a05:6402:1768:: with SMTP id da8mr825201edb.216.1588917645009; Thu, 07 May 2020 23:00:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588917645; cv=none; d=google.com; s=arc-20160816; b=GDQ3jIU/RkXzu6AzJinY/1YMKwQJVa1ilqOboHBNLfVk2Q80oYA88ehqw0mSNrfxQk a91ZOdfxKXIvobqO3F0x4/GYTN2yDlpzGt9QOKdNNn6hPfQSwYXkgG67GH2fyG4R+SiU TsyhEUGUv+7em5AQ/RSk9pYahXGv7zYy1mhMsQZ6X2ZrAHc4zxB1xVE2rWG1WKIg9YY0 EPXZm5rK7iR+g45XViXTreJh1J77KfN9u7Ncg7ozgbgcjTCXh+PhV3YWP+JKBkrwTyBU 9umn6Xt1UQ1Vn9T5xg7UkSTQ8r5hd1bBfXYmKX12I2zqO60627pJ4ZCmYADcN3DJ7tio 9/9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=lh/QYa6TXKAmyjyXLEoH06YeHzZdM5IeXYyjLTgHaJI=; b=D3jyU+yovhNBeMD3GindiwCOHbOctXfm2UPzNSz2CMhPZV8y7mKXUCICws84tw6quc 2FwbwAD8sUbksEuD75mJZWMv6q8YGizInB9IUGbR1JDV4EU9sfwKk+4mHDw3RYkJfwEn WcEFjlLCEHHSum3JeeEAy95556dhRnZSsZpuDWGv/ujpQhOAIRiwWWMx5+7/yZ/zN4JY xMOoQtIBwz42x/A+ReY3eukfDOjNDCJaZKLTS4Ywne7b/qIJ5n1siexTuLcGhFw6Fw4E 6wfMi2enxQhKnHHwdznHa0QVQQNPRnAIM2S3IsxCzDAhGLftv6ygERvxkZ6QVfbjcFB8 UhRQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y4si379111edv.549.2020.05.07.23.00.21; Thu, 07 May 2020 23:00:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727942AbgEHF6Y (ORCPT + 99 others); Fri, 8 May 2020 01:58:24 -0400 Received: from esa2.mentor.iphmx.com ([68.232.141.98]:2693 "EHLO esa2.mentor.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727917AbgEHF6W (ORCPT ); Fri, 8 May 2020 01:58:22 -0400 IronPort-SDR: ZpqTchIRYgUBl24PfM/5caqAn/X2791qnf2VUApgTU50eTBH4r8OWu3RhKsakgUr6ePfx1BZej ywY0fI2hJ852mbQr0eSi3kHFMSV1kNR6ItaO9EY4McbyhNwEv/F7NJe/J7mhPmxuphL2UYisR0 IEVVrlWNfbRrVl+eXli+fVeQFCQsuRBqmvpWomsmv4joIrG3Axn/yZl6v/Wg4UBO7mgrgC/str /GOSDIBUVdSW1vwsI4EpH4uEW88GhE+Pf0lXTzGjdeM/LIBBEKHv0a+Bq2IjVpC+BzDNpiPoy7 Mvg= X-IronPort-AV: E=Sophos;i="5.73,366,1583222400"; d="scan'208";a="48589089" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa2.mentor.iphmx.com with ESMTP; 07 May 2020 21:58:21 -0800 IronPort-SDR: QpgF3jsE9EDTAHw+EahVPXT5luom99XRRZBfLm//vN7NVQZqBHalhffWiYMHcUNGm7ft1ykpCH nje7qvn0m9ZtM0XdIAABou4y0tWtFViaLzDZjHC33qJzLee7TdlwMJMnmYMEQppclaT+/5evrk OGe5iLBp+cvNVuEvdtXkVMNTZJmsrOyRxcnhExY44qZOBIwtsEUttG7j2pys+uWfUiXEJyRgdx oNK75w5nsX3qvoig9e9WwHnVHsQb39ZySqDWrWKcSwLKInk+ZLHs5NXWV7difoIu5h14Srr/Q9 A9w= From: Jiada Wang To: , , , , CC: , , , , Subject: [PATCH v11 21/56] Input: atmel_mxt_ts - check data->input_dev is not null in mxt_input_sync() Date: Thu, 7 May 2020 22:56:21 -0700 Message-ID: <20200508055656.96389-22-jiada_wang@mentor.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200508055656.96389-1-jiada_wang@mentor.com> References: <20200508055656.96389-1-jiada_wang@mentor.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Janus Cheng * Symptom: if update_fw and update_cfg, kernel panic occurs. * Reproducibility: 10% * Root Cause: - If update_fw, the T6 will send a CFG_ERR message periodically. - After that, update_cfg process begin, the mxt_update_cfg_store() will invoke mxt_free_input_device() and nullify data->input_dev. - The CFG_ERR message will trigger mxt_interrupt(), and mxt_input_sync() will be invoked by mxt_process_messages_t44(). And mxt_input_sync() references a NULL data->input_dev and kernel panic occurs. TrackerRMS TKT-004235 Signed-off-by: Janus Cheng Signed-off-by: Nick Dyer (cherry picked from ndyer/linux/for-upstream commit c909ada856861f305653b127db3ea0fa60264331) [gdavis: Resolve forward port conflicts due to applying upstream commit 96a938aa214e ("Input: atmel_mxt_ts - remove platform data support").] Signed-off-by: George G. Davis Signed-off-by: Jiada Wang --- drivers/input/touchscreen/atmel_mxt_ts.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 503e70603a67..85b903b8d5c9 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -838,9 +838,11 @@ static void mxt_input_button(struct mxt_data *data, u8 *message) static void mxt_input_sync(struct mxt_data *data) { - input_mt_report_pointer_emulation(data->input_dev, - data->t19_num_keys); - input_sync(data->input_dev); + if (data->input_dev) { + input_mt_report_pointer_emulation(data->input_dev, + data->t19_num_keys); + input_sync(data->input_dev); + } } static void mxt_proc_t9_message(struct mxt_data *data, u8 *message) -- 2.17.1