From patchwork Thu Feb 18 08:23:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: samu.p.onkalo@nokia.com X-Patchwork-Id: 80216 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o1I8OBdm005587 for ; Thu, 18 Feb 2010 08:24:11 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751652Ab0BRIYK (ORCPT ); Thu, 18 Feb 2010 03:24:10 -0500 Received: from smtp.nokia.com ([192.100.122.233]:53705 "EHLO mgw-mx06.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751867Ab0BRIYJ (ORCPT ); Thu, 18 Feb 2010 03:24:09 -0500 Received: from vaebh105.NOE.Nokia.com (vaebh105.europe.nokia.com [10.160.244.31]) by mgw-mx06.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o1I8NlBY030384; Thu, 18 Feb 2010 10:23:49 +0200 Received: from esebh102.NOE.Nokia.com ([172.21.138.183]) by vaebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 18 Feb 2010 10:23:47 +0200 Received: from mgw-da02.ext.nokia.com ([147.243.128.26]) by esebh102.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Thu, 18 Feb 2010 10:23:46 +0200 Received: from localhost.localdomain (4fid08082.nmp.nokia.com [172.22.211.11]) by mgw-da02.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o1I8Nfgi028952; Thu, 18 Feb 2010 10:23:41 +0200 From: Samu Onkalo To: dmitry.torokhov@gmail.com Cc: linux-input@vger.kernel.org, oleg@redhat.com, Samu Onkalo Subject: [PATCHv2] input: polldev can cause crash in case of polling disabled Date: Thu, 18 Feb 2010 10:23:40 +0200 Message-Id: <1266481420-9405-1-git-send-email-samu.p.onkalo@nokia.com> X-Mailer: git-send-email 1.6.0.4 X-OriginalArrivalTime: 18 Feb 2010 08:23:47.0168 (UTC) FILETIME=[B10DCE00:01CAB073] X-Nokia-AV: Clean Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 18 Feb 2010 08:24:11 +0000 (UTC) diff --git a/drivers/input/input-polldev.c b/drivers/input/input-polldev.c index aa6713b..291d939 100644 --- a/drivers/input/input-polldev.c +++ b/drivers/input/input-polldev.c @@ -100,6 +100,12 @@ static void input_close_polled_device(struct input_dev *input) struct input_polled_dev *dev = input_get_drvdata(input); cancel_delayed_work_sync(&dev->work); + /* + * Clean up work struct to remove references to the workqueue. + * It may be destroyed by the next call. This causes problems + * at next device open-close in case of poll_interval == 0. + */ + INIT_DELAYED_WORK(&dev->work, dev->work.work.func); input_polldev_stop_workqueue(); if (dev->close)