From patchwork Thu Aug 7 14:07:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Dyer X-Patchwork-Id: 4691371 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 63890C0338 for ; Thu, 7 Aug 2014 14:08:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 790A6201D5 for ; Thu, 7 Aug 2014 14:08:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 57C6F200F0 for ; Thu, 7 Aug 2014 14:08:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757488AbaHGOH1 (ORCPT ); Thu, 7 Aug 2014 10:07:27 -0400 Received: from kdh-gw.itdev.co.uk ([89.21.227.133]:13878 "EHLO hermes.kdh.itdev.co.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757353AbaHGOH0 (ORCPT ); Thu, 7 Aug 2014 10:07:26 -0400 Received: from localhost.localdomain (unknown [82.20.71.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by hermes.kdh.itdev.co.uk (Postfix) with ESMTPSA id 564F083AFA; Thu, 7 Aug 2014 15:07:24 +0100 (BST) From: nick.dyer@itdev.co.uk To: Dmitry Torokhov Cc: Yufeng Shen , Daniel Kurtz , Henrik Rydberg , Joonyoung Shim , Alan Bowens , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Meerwald , Benson Leung , Olof Johansson , Sekhar Nori , Stephen Warren , Nick Dyer Subject: [PATCH 1/2] Input: atmel_mxt_ts - Fix double free of input device Date: Thu, 7 Aug 2014 15:07:17 +0100 Message-Id: <1407420438-6289-2-git-send-email-nick.dyer@itdev.co.uk> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1407420438-6289-1-git-send-email-nick.dyer@itdev.co.uk> References: <1407420438-6289-1-git-send-email-nick.dyer@itdev.co.uk> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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: Stephen Warren Signed-off-by: Nick Dyer --- drivers/input/touchscreen/atmel_mxt_ts.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 03b8571..da497db 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -1353,8 +1353,10 @@ static int mxt_get_info(struct mxt_data *data) static void mxt_free_object_table(struct mxt_data *data) { - input_unregister_device(data->input_dev); - data->input_dev = NULL; + if (data->input_dev) { + input_unregister_device(data->input_dev); + data->input_dev = NULL; + } kfree(data->object_table); data->object_table = NULL; @@ -2194,7 +2196,6 @@ static int mxt_remove(struct i2c_client *client) sysfs_remove_group(&client->dev.kobj, &mxt_attr_group); free_irq(data->irq, data); - input_unregister_device(data->input_dev); mxt_free_object_table(data); kfree(data);