From patchwork Thu Nov 5 23:37:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Duggan X-Patchwork-Id: 7564301 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 75AE0C05C6 for ; Thu, 5 Nov 2015 23:38:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AF12320809 for ; Thu, 5 Nov 2015 23:38:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C706F20807 for ; Thu, 5 Nov 2015 23:38:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965450AbbKEXhg (ORCPT ); Thu, 5 Nov 2015 18:37:36 -0500 Received: from us-mx2.synaptics.com ([192.147.44.131]:27816 "EHLO us-mx1.synaptics.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965377AbbKEXhe (ORCPT ); Thu, 5 Nov 2015 18:37:34 -0500 Received: from unknown (HELO securemail.synaptics.com) ([172.20.21.135]) by us-mx1.synaptics.com with ESMTP; 05 Nov 2015 15:37:33 -0800 Received: from USW-OWA1.synaptics-inc.local ([10.20.24.16]) by securemail.synaptics.com (PGP Universal service); Thu, 05 Nov 2015 16:37:57 -0800 X-PGP-Universal: processed; by securemail.synaptics.com on Thu, 05 Nov 2015 16:37:57 -0800 Received: from noble.synaptics-inc.local (10.4.10.145) by USW-OWA1.synaptics-inc.local (10.20.24.16) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 5 Nov 2015 15:37:33 -0800 From: Andrew Duggan To: , CC: Benjamin Tissoires , Dmitry Torokhov , Linus Walleij , Benjamin Tissoires , Christopher Heiny , Stephen Chandler Paul Subject: [PATCH 04/26] Input: synaptics-rmi4 - prevent oopses when irq arrives while the device is not bound Date: Thu, 5 Nov 2015 15:37:25 -0800 Message-ID: <1446766645-30350-1-git-send-email-aduggan@synaptics.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 X-Originating-IP: [10.4.10.145] Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Benjamin Tissoires If the device has been registered but is not populated, we should not process any incoming interrupt. Make sure the pointers we are following are valid. Signed-off-by: Benjamin Tissoires Tested-by: Andrew Duggan Tested-by: Linus Walleij --- drivers/input/rmi4/rmi_driver.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c index 2fdc7e8..fe5f2f9 100644 --- a/drivers/input/rmi4/rmi_driver.c +++ b/drivers/input/rmi4/rmi_driver.c @@ -279,6 +279,9 @@ int rmi_process_interrupt_requests(struct rmi_device *rmi_dev) struct rmi_function *entry; int error; + if (!data || !data->f01_container || !data->irq_status) + return 0; + error = rmi_read_block(rmi_dev, data->f01_container->fd.data_base_addr + 1, data->irq_status, data->num_of_irq_regs);