From patchwork Sun Jan 19 18:14:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: js X-Patchwork-Id: 208260 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7900DC33CB1 for ; Sun, 19 Jan 2020 18:15:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4442320679 for ; Sun, 19 Jan 2020 18:15:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PYexgQoI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727144AbgASSPE (ORCPT ); Sun, 19 Jan 2020 13:15:04 -0500 Received: from mail-ot1-f66.google.com ([209.85.210.66]:44222 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727111AbgASSPE (ORCPT ); Sun, 19 Jan 2020 13:15:04 -0500 Received: by mail-ot1-f66.google.com with SMTP id h9so26690793otj.11 for ; Sun, 19 Jan 2020 10:15:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=0MrTpv+HDBPNR7/4Dq9BS8nqKwI3pL3S3fRcWBhKH8Q=; b=PYexgQoI3cAhnYcApsrqj/TQjYXLL+1uRDWhtf50u6undgDWhrn+nrGTq8yQdlz3VQ kLcyWkCYpbdU5nW7pcqZGXl4O4pCtJDXtuBH+1OGVxtRDHe8yNTQvcTu1FjVcbRXr87z R6Zg5NFRuCetsm0wMGb6Z8lijzN818BaUWXnioXqcPTJEPUhzpye3qXCU0GED0dPaww0 vNkFKlHv8YbrVRiAP2VMB9pIj/GLz+O4xdbhrhsHx+d4e5K0eGQENmbfyhT2zdJoJLx4 LmwGX7pmdEdq1xgrCXB9MZiIJGQFrmJb7fcuWV42jdsjTr1Yl37Xj1P0kutWZIl0Uzx9 TfXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=0MrTpv+HDBPNR7/4Dq9BS8nqKwI3pL3S3fRcWBhKH8Q=; b=QHuztbz/RX/dvGqq0dw1L8DBvoRTVM5YphbraBm8E/S9Vg05eM6nwLFD10sobD2GB5 52dQYWNgHpp66/XJ4hy1qhheoLURUhY9owZu8M4hjOzxGwgMHUZ1mCNNrLoJihCOD0m6 jNhqP/axvA2EpJRo7J3AgO8g8zJ+O3x3a3wjKY6c6jsLxQuuCfRuWQ++1tg074Sgj3pK +bNX7Q0Lh47khOyzsC8Z9yqKAywmYsqr5l758NhEcJuc3vR4pemBHxkqV7K8qgtpkQx4 TXigz6G47ZgMUDAbpL1aA4vZ+e8xmTk0VjVRIJmCKEZb94n0FbwzDclsy8WfXZrU4lZL Msug== X-Gm-Message-State: APjAAAU0KDkKWyBam5gjdeyGVT6Op2NSg0cwqb19nqX/LmAb4zP6a2Vz zHzDbqZPLsPwuHYW6ZOVZEn4nqZNntl/1CEJfqE= X-Google-Smtp-Source: APXvYqxEXwda8VmpqokD8xMmyIFiIVfS7sUH8TtvqVXK+jboAh7i2riHS9cOuOD5w2R3c62U6wezYGjShsso3ENrD7w= X-Received: by 2002:a9d:7d85:: with SMTP id j5mr13457255otn.86.1579457703379; Sun, 19 Jan 2020 10:15:03 -0800 (PST) MIME-Version: 1.0 From: js Date: Sun, 19 Jan 2020 13:14:52 -0500 Message-ID: Subject: [BUG + PATCH] HID ELAN9038 probe fails with "report is too long" To: Jiri Kosina Cc: linux-input@vger.kernel.org, Benjamin Tissoires Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org i posted this bug to bugzilla with the attached patch. this email is to notify the maintainers. https://bugzilla.kernel.org/show_bug.cgi?id=206259 thanks! js ---- ELAN i2c digitizer on microsoft surface go fails to initialize and device is non-functional initialization fails on 4.19.96: ---- [ 5.507245] hid-generic 0018:04F3:261A.0005: report is too long [ 5.507256] hid-generic 0018:04F3:261A.0005: item 0 1 0 8 parsing failed [ 5.507290] hid-generic: probe of 0018:04F3:261A.0005 failed with error -22 [ 5.556409] hid-multitouch 0018:04F3:261A.0005: report is too long [ 5.581641] hid-multitouch 0018:04F3:261A.0005: item 0 1 0 8 parsing failed [ 5.618495] hid-multitouch: probe of 0018:04F3:261A.0005 failed with error -22 initialization succeeds on 4.19.95: ---- [ 7.150887] hid-generic 0018:04F3:261A.0001: input,hidraw2: I2C HID v1.00 Device [ELAN9038:00 04F3:261A] on i2c-ELAN9038:00 [ 8.253077] input: ELAN9038:00 04F3:261A as /devices/pci0000:00/0000:00:15.1/i2c_designware.1/i2c-1/i2c-ELAN9038:00/0018:04F3:261A.0001/input/input20 [ 8.253219] input: ELAN9038:00 04F3:261A Pen as /devices/pci0000:00/0000:00:15.1/i2c_designware.1/i2c-1/i2c-ELAN9038:00/0018:04F3:261A.0001/input/input23 [ 8.253330] hid-multitouch 0018:04F3:261A.0001: input,hidraw0: I2C HID v1.00 Device [ELAN9038:00 04F3:261A] on i2c-ELAN9038:00 problem seems to be due to this commit: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-4.19.y&id=31d06cc8e7caec36bedeb4f90444920431462f61 diff -rupN linux-4.19.97/drivers/hid/hid-core.c linux-4.19.97-1/drivers/hid/hid-core.c --- linux-4.19.97/drivers/hid/hid-core.c 2020-01-17 18:47:17.000000000 +0000 +++ linux-4.19.97-1/drivers/hid/hid-core.c 2020-01-19 16:31:31.823005977 +0000 @@ -290,8 +290,11 @@ static int hid_add_field(struct hid_pars /* Total size check: Allow for possible report index byte */ if (report->size > (HID_MAX_BUFFER_SIZE - 1) << 3) { - hid_err(parser->device, "report is too long\n"); - return -1; + hid_err(parser->device, + "report is too long: %d > %d\n", + report->size, + (HID_MAX_BUFFER_SIZE - 1) << 3); + return 0; } if (!parser->local.usage_index) /* Ignore padding fields */