Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9170862pxu; Mon, 28 Dec 2020 08:19:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJyP7lygLuWxWrOYPis+lzc3gBxW2cI/c/B7LqiNA+X3n6v9ehIGZC2n0cpOG5iB3V/pq7tP X-Received: by 2002:a50:e719:: with SMTP id a25mr42710516edn.12.1609172397164; Mon, 28 Dec 2020 08:19:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609172397; cv=none; d=google.com; s=arc-20160816; b=td/UZTlf2VJX+H4pjV8LderfVmEiaWOJuUkOPcGmwzGmAj+S2OJYj9Hk3w8LRp9HF7 VQ6W5J982jUeO1COUlC6rp2ZYvO1R1iBj4QHELIIpCRaiBLfOOr8i51u96gZeWcrAkm0 M8/Nk+5oVOGyClP79e+/G6o3RCdlt9xu6uF952YKBm1Vej4WP3NGhwQ8VbMFNgFeWDFO 9IMK+lzMPdMBnrS97UP1Qnduho2KtJY0jgKzT5yV9/GDhKGBsZEgdHTqUM2x0A1gKNsk 4huzinxdTxCeLLVjaWDouPDmvGmmVyk0seEYY76KkhRErn/FioFiSopTp0rchfTsWlDs UDZg== 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=uJEnQiKLuMUhqz5TBOUK2YnXCbCymYqHv/I+2IeABlKwBLUQzcx99/tLJbPzu5FV8w 1C+ynwfWcdqQFbKwWL1S+mx4+VY5ldfvNJsu6Iv7w85s8oNAg/051lQKPRPNutSqX2In 4HJ49Oc9y7aEhESO+sssBA0KskmcRZTNG8udfxinEKgAbzTPMVeZFnBh/HnpJV5KzmPy LSopjn86iWqtk1XtFhl4rVr+utzQj3hYyvkqhhY9dlfBwWUEIO5X4b8eMswyVt0o4sO8 LrpgbBrLieNCrahVpBZc2lzrCuSk1zUQiLeSsUU5NXq8NUqCRRSEjLHqYODDVXlDvIj3 u7YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mXa7jv3E; 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 m14si19033489ejr.242.2020.12.28.08.19.34; Mon, 28 Dec 2020 08:19:57 -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=mXa7jv3E; 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 S1733204AbgL1NQY (ORCPT + 99 others); Mon, 28 Dec 2020 08:16:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:44242 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733024AbgL1NQK (ORCPT ); Mon, 28 Dec 2020 08:16:10 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6DE5120728; Mon, 28 Dec 2020 13:15:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609161354; bh=cRicDIf1s2m/epyd1+FFfQ5TZVTtW4rSXtzd0631iK0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mXa7jv3E77NyD+YK9PJff1YxLgzjhbH2n+8pn7r2hJvAMjx3/q7UrVogDZ5qRY4Vu SjB6Vz+XAzRQ41lNI+RqLms+QrhMowEuk7tp0/ii+MNVFa7IYgGa0lRdgPvZeX/FCz yLUynlzPMFdljAkM4jciyQHZHPsZEorAMyd461j8= 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.14 187/242] ACPI: PNP: compare the string length in the matching_id() Date: Mon, 28 Dec 2020 13:49:52 +0100 Message-Id: <20201228124913.904559765@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124904.654293249@linuxfoundation.org> References: <20201228124904.654293249@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;