Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9181324pxu; Mon, 28 Dec 2020 08:36:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJz8XrF4rJtihEXwi71D6zkPZHo0l8QQZi+uBMGGqm2MZhp2PCdN6eDBY4WJ30+ATHpKS8O2 X-Received: by 2002:a17:906:234d:: with SMTP id m13mr2637207eja.270.1609173369621; Mon, 28 Dec 2020 08:36:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609173369; cv=none; d=google.com; s=arc-20160816; b=sZCNs/WTzHYPGdI3U6wcDToJVUXS4CMDok2w8s7pQzZARUpnIYqEghANMSGvxAPVKP jWYvOtUn8HM2zzNoR2A4YjVXLxs0T4BsASC9zQCd94SmWVmQXlg97SEOvDLHcxcig2F9 gJfrILiZ+0YShYYC11RgXUnlLT6WwE/Fjbdhiw48dRHdJmdREbu15gaZ+miJf5BDby0C k7UNY5rnylGqiuLimpMudsajhzlnLc95Z1PgzYaOhxHBSsg3aGQesefGzVqWI8cyHAhV ACSNxtn1CX7wvXuSIS3RD/DexYA7ss+yHuwi50RDRYEOH5vgIojkobPZzPOwMajL0+Vo XJNA== 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=xZ2tsoLyOEKmf44smd+8e+ZNfGo6B4zz/V6X3hYk4x0=; b=qS7TAuH+xvBRWDVWeJSs1gNZRKNjZiIyoHSTIYV/Gke7YOUWj0wz6BhIccb7Y8qvEV 6Cpkoct69+UHV/Lu/7H4kSPbgjnN7owOSUth9p+0brTiNVPYPoOysNiTu1oda+7nUbUv rLmP79h7w7uag06DMT4DdaBaJG3lUP7NgcqN+kn5R/GgloDeRYH5hGpdQp/giy22LNya epOjwsbqmh6+qjqFAwxzNKKrULtqCsEwjqWQIVzGSm+WI9w1QuNHNmtzXwGt93E/H6nv sr7dbzIwrxtbDmGWkAvdnLXqNAFVO6J9NTePjg8TyhY5B1ufol0xLaphp+rVJqCvq9kf 3SWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DqU6jQMl; 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 s25si18661668ejz.414.2020.12.28.08.35.46; Mon, 28 Dec 2020 08:36:09 -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=DqU6jQMl; 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 S2633436AbgL1QdA (ORCPT + 99 others); Mon, 28 Dec 2020 11:33:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:33276 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730615AbgL1NF1 (ORCPT ); Mon, 28 Dec 2020 08:05:27 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 637C821D94; Mon, 28 Dec 2020 13:04:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609160685; bh=cRicDIf1s2m/epyd1+FFfQ5TZVTtW4rSXtzd0631iK0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DqU6jQMljyrFHhwNbsmsPkvmkKcylmqyPtp0ds2Ic7KC356THu016VSr5nr7JIz69 Y3MgBWGonn1S/AXDww8Omu7FuM0LDbsO6vHYLaqFCbyawaHni6u/VZyzFWTGb9m4Pn MI4N+74Aiu2kPSItF0C0mKaHDHsSSxTNM1cOrH3w= 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 4.9 136/175] ACPI: PNP: compare the string length in the matching_id() Date: Mon, 28 Dec 2020 13:49:49 +0100 Message-Id: <20201228124859.835762152@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124853.216621466@linuxfoundation.org> References: <20201228124853.216621466@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 @@ -320,6 +320,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;