Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp721292pxb; Tue, 2 Feb 2021 16:40:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJwKdYBSpd5ws5ObG5Bl5SF7BWSKmbm8CKOPOz8RfHXov9FH5YNphaRnnfX4ViD7FJqUy4yN X-Received: by 2002:a17:906:2f07:: with SMTP id v7mr576497eji.343.1612312839924; Tue, 02 Feb 2021 16:40:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612312839; cv=none; d=google.com; s=arc-20160816; b=fSUt+8FnJHcT2sjmooU922l+G79lmTtwR5dUsxqaJe8P+L6T7OqL7+/36JdSdnvNsC vR4IIHEyaWVSGfxASUlpoI5VuVadRCdfSJruRvTBQzcF1uaDRT2Oq5wg4s/BEDTWF88t 9YJkbRW2g7I1+FUsQHZn/NumSca0knvw8ubUtX3F6d3amCvNCqf7h6NAnKyBLGy6IPnw ZAKrUYIK24FCoIkCCSDr28chk75Dm73R+8YHSs4N49LqtsS4EoJPPdKka3+rvRil2KxD A7az4g5fFp/rRbBMU2z3pzJlcvbk3qT0mVlbg1GwChLaqSpJ8rf7s+/g4/aF8s1+Erte IcgQ== 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=crvCXMp5U6VG6l3P1m4XNVZzLlvAwPDaTnajV/aamyw=; b=w0yFPTbZ0O+WwxzRbrHZpY9IlRVywq7si9jVOY6YYNynjJK9HOV/l72N0HzyAfU5p5 FOI2koVy1rpddNKDaq1846ZFGCt1yY8uzl4DxfAAcKDwnEadQY9bmi3+pCFgozxD5Eak J4P13xnJfw3a+NawDqduiDEiJZ+zbMtgc5iy+ELvz4ZRWicOOlJvMW2HUspEyzvPmrCt r4OV7x64oSofr/HDvKSZJ5uY23tYxLaWFtIk2iMIt0BcegXIJE/y4AYIenzLkePQ7hUz G+dv+DHjJ4Rl+APCO+Fo0s+XQ1wdjbK1ZgiBOVdx+IaRISxsHespL5SKOd1tqQmV3uXu VVXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SnHWLwbE; 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 l24si285156eje.495.2021.02.02.16.40.15; Tue, 02 Feb 2021 16:40:39 -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=SnHWLwbE; 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 S233522AbhBBSiz (ORCPT + 99 others); Tue, 2 Feb 2021 13:38:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:47076 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233810AbhBBOFH (ORCPT ); Tue, 2 Feb 2021 09:05:07 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id DB4BD65017; Tue, 2 Feb 2021 13:48:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1612273730; bh=GpN8qT98RVpJc8qD5Ha46R+uHPu6WMXFK8MHkJqvxd8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SnHWLwbE3f2gpGpnfJcJNdefE8FrEPP7xQFdz25T74GzUo9c/z1smw9I8ZZH85ruN Xp32GVIwMSEsuxZuNPFB68aqExTzgL7bLKIryxePqJBRDG77XccfC0Hzh5+FxYPW5P glsgDeIMlpXQGJGrZ7lRpQSQTNoz3wFO0gUnf7Zs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mika Westerberg , Kai-Heng Feng , "Rafael J. Wysocki" Subject: [PATCH 4.4 01/28] ACPI: sysfs: Prefer "compatible" modalias Date: Tue, 2 Feb 2021 14:38:21 +0100 Message-Id: <20210202132941.247101839@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210202132941.180062901@linuxfoundation.org> References: <20210202132941.180062901@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore 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: Kai-Heng Feng commit 36af2d5c4433fb40ee2af912c4ac0a30991aecfc upstream. Commit 8765c5ba1949 ("ACPI / scan: Rework modalias creation when "compatible" is present") may create two "MODALIAS=" in one uevent file if specific conditions are met. This breaks systemd-udevd, which assumes each "key" in one uevent file to be unique. The internal implementation of systemd-udevd overwrites the first MODALIAS with the second one, so its kmod rule doesn't load the driver for the first MODALIAS. So if both the ACPI modalias and the OF modalias are present, use the latter to ensure that there will be only one MODALIAS. Link: https://github.com/systemd/systemd/pull/18163 Suggested-by: Mika Westerberg Fixes: 8765c5ba1949 ("ACPI / scan: Rework modalias creation when "compatible" is present") Signed-off-by: Kai-Heng Feng Reviewed-by: Mika Westerberg Reviewed-by: Greg Kroah-Hartman Cc: 4.1+ # 4.1+ [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- drivers/acpi/device_sysfs.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) --- a/drivers/acpi/device_sysfs.c +++ b/drivers/acpi/device_sysfs.c @@ -259,20 +259,12 @@ int __acpi_device_uevent_modalias(struct if (add_uevent_var(env, "MODALIAS=")) return -ENOMEM; - len = create_pnp_modalias(adev, &env->buf[env->buflen - 1], - sizeof(env->buf) - env->buflen); - if (len < 0) - return len; - - env->buflen += len; - if (!adev->data.of_compatible) - return 0; - - if (len > 0 && add_uevent_var(env, "MODALIAS=")) - return -ENOMEM; - - len = create_of_modalias(adev, &env->buf[env->buflen - 1], - sizeof(env->buf) - env->buflen); + if (adev->data.of_compatible) + len = create_of_modalias(adev, &env->buf[env->buflen - 1], + sizeof(env->buf) - env->buflen); + else + len = create_pnp_modalias(adev, &env->buf[env->buflen - 1], + sizeof(env->buf) - env->buflen); if (len < 0) return len;