From patchwork Wed May 20 00:42:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ping Cheng X-Patchwork-Id: 6441251 X-Patchwork-Delegate: jikos@jikos.cz 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 88BCDC0432 for ; Wed, 20 May 2015 00:42:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ADB65203B7 for ; Wed, 20 May 2015 00:42:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AFAEA203AE for ; Wed, 20 May 2015 00:42:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752126AbbETAmP (ORCPT ); Tue, 19 May 2015 20:42:15 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]:33508 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751323AbbETAmM (ORCPT ); Tue, 19 May 2015 20:42:12 -0400 Received: by padbw4 with SMTP id bw4so45802454pad.0 for ; Tue, 19 May 2015 17:42:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=yUd9vsUWfrN2n4XM9NgMvheJgL86LBb8XFUvy1uTypY=; b=KFwUTbyzcWHQVE9zBEcNpQOUKd/25fLN9JBJTaAw/ckNTxzO8WV9UhovyvOJpmYM+g sljqh62TIF2PLEC5Tw0sR0mowRa+u+NKmf39kVAzr2NhlevveOW5NSL8bi0RfSsqg2aL OI9S20Fqmd+7BSpLvfBBOwA3R5noS2ReKoG847sULN3/EeNa0bdpItUj8JZVRsjztAr6 EhJUM+MAvv9hMaEQFyhPOes8ts4telx6NRo/ladmrkPmJPUKCYsIllcKjTqsn5xgLmR0 X/YzdEc9to6VDkmwAHk4KqUvRPgNul2ofZoqkmQG4lET7q7z1nCUyBwhrso133fVdQ2f 2y/g== X-Received: by 10.70.44.3 with SMTP id a3mr59438614pdm.93.1432082532109; Tue, 19 May 2015 17:42:12 -0700 (PDT) Received: from wacom-XPS-8500.wacom.com ([67.51.163.2]) by mx.google.com with ESMTPSA id ap9sm14290246pad.42.2015.05.19.17.42.11 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 May 2015 17:42:11 -0700 (PDT) From: Ping Cheng X-Google-Original-From: Ping Cheng To: jkosina@suse.cz Cc: linux-input@vger.kernel.org, tasos@tasossah.com, Ping Cheng Subject: [PATCH] HID: wacom: fix an Oops caused by wacom_wac_finger_count_touches Date: Tue, 19 May 2015 17:42:02 -0700 Message-Id: <1432082522-4107-1-git-send-email-pingc@wacom.com> X-Mailer: git-send-email 1.9.1 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.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, 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 We assumed all touch interfaces report touch data. But, Bamboo and Intuos non-touch devices report express keys on touch interface. We need to check touch_max before counting touches. Reported-by: Tasos Sahanidis Signed-off-by: Ping Cheng --- Hi Jiri, this patch is based on for-4.1/wacom. The issue was initially introduced in 4.1. --- drivers/hid/wacom_wac.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 69c7df7..1cd80d2 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -1072,6 +1072,9 @@ static int wacom_wac_finger_count_touches(struct wacom_wac *wacom) int count = 0; int i; + if (!touch_max) + return 0; + /* non-HID_GENERIC single touch input doesn't call this routine */ if ((touch_max == 1) && (wacom->features.type == HID_GENERIC)) return wacom->hid_data.tipswitch &&