Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9420452pxu; Mon, 28 Dec 2020 15:56:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJz6qK/WOjZp1jxdEO4qdKMN4y9/3eUzV9dynjWQ5ox4YYzQUavjQt6W8TWKLe70EnmFXR1Y X-Received: by 2002:a17:906:6d47:: with SMTP id a7mr44404442ejt.340.1609199816414; Mon, 28 Dec 2020 15:56:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609199816; cv=none; d=google.com; s=arc-20160816; b=j6X3gh7fJ5SASXviryWeuO9FAi7xMvF9OH3iVw37BOGDfX+EaWeMhuapSiC+PxpZW+ ej/kUffX0Uakdk/PtgP0N1hYfJFJqPIfEAezyYL1+UM7bQ2PqMzj7eNiFD91YH/goyQG UraBd1X8S8DHwVlI4z1rUaLkn5knyuk4JHe0DGfz8kS5Jx9UCyRUkllKB6BuINYKj9sI N0wu5OxrsGrBlSHD+UUyOhpG3Vy01iaYAp/apq/uQiWPT6LSe+T6ytFnJlEjI1ddYrk6 IZGL+95zlbZnZLdqrNeKSm5deS8TBwQqTWbN46KXkxcn2OKVx27pRv7Kk9AoM4VrhPl8 aVyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jDqnoVnAtcHPFXkTQGWWUW4+tpBtVbPdkif+PdAOErk=; b=AZ52z2XwuxaqNhy8PL3iFifdOUca5FPt2K4h+VnNs1/f26YHCHaEw0WgLLBwP8jfRv K4m9atFBeppwDR6vxq5ikjqTGr/YuZQqMluom4bBIWQWW+fgIF+EGt2k3sd2uNHy4zuD M04NI4my8yklZ9J3j41pEOjxVj9efQ/4mqr0COSqzVT85WpJ7pX/sAmRizPXAkRZkfi+ fimiO7u1UhmlYdBjJXBGuGCfpOhdRxPgHBG9kp6fLhnh8a5FIneosoHrpah8jV9cvRit gs6SILKtLyvWbyS8rH7BzguXZq+zAF6C/jUrl8oldYNireMiL8OQAVOmkZqQOA0psGPk cQow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MOspK4wZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p17si20518415ejd.570.2020.12.28.15.56.34; Mon, 28 Dec 2020 15:56:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MOspK4wZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2408017AbgL1Opu (ORCPT + 99 others); Mon, 28 Dec 2020 09:45:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:59798 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503057AbgL1OYV (ORCPT ); Mon, 28 Dec 2020 09:24:21 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 067C922D04; Mon, 28 Dec 2020 14:24:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165446; bh=8VkzJDBeMi29PFDS0HI5w7Ul2rXmw/Asb617Y2dy6Sk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MOspK4wZb1kmqeZMfetx2i5reiIDOEH+ugsfJDPcQKXN9YdHoYLPnPi3v/yU9vZvq 5wlnmmPVXH5GnVEQL2coUnHU8IxiKSYc9K0eowH8Xm7NxIDpdgbD7OpRFzMJLl6s+f ysDx5WdbXeDvqzxOOdVRufSXhMaJvgOmQQ/7Yvl4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Rafael J. Wysocki" , Hui Wang Subject: [PATCH 5.10 534/717] ACPI: PNP: compare the string length in the matching_id() Date: Mon, 28 Dec 2020 13:48:52 +0100 Message-Id: <20201228125046.556137216@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hui Wang commit b08221c40febcbda9309dd70c61cf1b0ebb0e351 upstream. Recently we met a touchscreen problem on some Thinkpad machines, the touchscreen driver (i2c-hid) is not loaded and the touchscreen can't work. An i2c ACPI device with the name WACF2200 is defined in the BIOS, with the current rule in matching_id(), this device will be regarded as a PNP device since there is WACFXXX in the acpi_pnp_device_ids[] and this PNP device is attached to the acpi device as the 1st physical_node, this will make the i2c bus match fail when i2c bus calls acpi_companion_match() to match the acpi_id_table in the i2c-hid driver. WACF2200 is an i2c device instead of a PNP device, after adding the string length comparing, the matching_id() will return false when matching WACF2200 and WACFXXX, and it is reasonable to compare the string length when matching two IDs. Suggested-by: Rafael J. Wysocki Signed-off-by: Hui Wang Cc: All applicable Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- drivers/acpi/acpi_pnp.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/acpi/acpi_pnp.c +++ b/drivers/acpi/acpi_pnp.c @@ -319,6 +319,9 @@ static bool matching_id(const char *idst { int i; + if (strlen(idstr) != strlen(list_id)) + return false; + if (memcmp(idstr, list_id, 3)) return false;