From patchwork Sat Oct 7 23:39:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 149657 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp1145219vqo; Sat, 7 Oct 2023 16:40:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFmJs+rXx38+eCFcLSnTjZYFQo9lJIHFjap+AKOsOW0Ak9R0QXv0fQ4WxaHcuEmHFPAyVP0 X-Received: by 2002:a05:6a00:2405:b0:68f:cd71:45d5 with SMTP id z5-20020a056a00240500b0068fcd7145d5mr13275131pfh.3.1696722037141; Sat, 07 Oct 2023 16:40:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696722037; cv=none; d=google.com; s=arc-20160816; b=fXvCdUeK8U8LdPBvhqX2ATMq9rb3ecyqtORwnGTr97Mbj5iOBiLbPGQfjWFfa6e3YQ 2gH815AzQ6/PWp90lht+iEZML66HgLty8o3V+WXfeojCKqsR4T5QhYnw5FXGUHb0uztN 6J09oocziardn/so1hvtnh3MYPKC0bC/XU0+JvC29vNamtXNAM7jTFHmHU4x46hMsqMi Ch+MW49X2hsBDKXBd2H7cgjHGh7VdB7kjmXZlrdwoS9Bx+jByJvqDlC1BVEw9uiLsWwW JrY+Ry9+lwvou6MaLukFMXwz3iLhCYXsCibHq1c1kWHaPuR6itRwS60AKW9iqxThRbU3 zSMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ReW/SzgPwvNtmUOJvXXnNm7hxF0svZkaR5QK8EMDylA=; fh=8KfVqr1qxxxqRnLLJWd1s6GBuyrXdAyRV8iNAMTuQpk=; b=iAt1IXyxUO65QRJnZip15X7Zr2lfo4dn6iDX+wqcu8CszT3v2Ix4O/6kuictcKx9ex 18dNeld6nHJvoKPRj9S8ILowY2J6yNm4cTSKLOZr1Sr+0TBkfeAjUPh2lirSDdyzFaM1 iHfs2ZfTI9D2cO9pKvHCpGWe+Tqkl2ZFhXxhrE/D61rGSqHIws+fgUZYSCP22FyCj3sS awFjiCqjLlab6a+/YkVIaOFWQx/bDtm8Ma/CPslR5oA1EOJwxeM67Rb73L7ii/6fZqRB +D3peKkENNRU7kB3VCUePZirwBm8FUd2YLUy9p+YqlQBsu5E/SFqD/ISMzQByv8p5PqJ sUFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=XL6aUvdW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id h14-20020a056a001a4e00b0068fefb0c039si4621963pfv.99.2023.10.07.16.40.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Oct 2023 16:40:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=XL6aUvdW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 16259808A420; Sat, 7 Oct 2023 16:40:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344261AbjJGXj6 (ORCPT + 17 others); Sat, 7 Oct 2023 19:39:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344250AbjJGXjy (ORCPT ); Sat, 7 Oct 2023 19:39:54 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 670E8D8; Sat, 7 Oct 2023 16:39:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1696721980; x=1697326780; i=w_armin@gmx.de; bh=NBubrQ6eNN+2+jfjz7U83zs3HdPq44DR/srwfNy27VY=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=XL6aUvdWcopw5Lmlddrfe81Sh75bfbf13YroMr8+gBYDhQrg1WwaI+QK6wQf/Yscx4GF1ZXWgGY P5FVFuhcyV5XsXg2EeWANEL0qpd8LSoFVGp6YAfMUIvSGgNqv7p6mBMetisVS6kik8Xk2qIxDUFKL q9/rps9jZC4AGCem2h2PcWeeT719EGBj/QSXwGdSkj1ktVqOw/YDh8ZDPA95Lr/qG3jMJ7T49vLLd 6gAhKSZvt1e3cn4FOnih34De5SQVR1M7mHrjBlWW2Jdit9z8cZaYekwhRg8whP7AOAF+Nh0YbZQav IimhMqXqTjiTZsCt5tGMbKOhKW5UzE2ZVYWQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from mx-amd-b650.users.agdsn.de ([141.30.226.129]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MHXBj-1qka3J0BSz-00DU1w; Sun, 08 Oct 2023 01:39:40 +0200 From: Armin Wolf To: hdegoede@redhat.com, markgross@kernel.org, ilpo.jarvinen@linux.intel.com Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/6] platform/x86: wmi: Update MAINTAINERS entry Date: Sun, 8 Oct 2023 01:39:28 +0200 Message-Id: <20231007233933.72121-2-W_Armin@gmx.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231007233933.72121-1-W_Armin@gmx.de> References: <20231007233933.72121-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:jRDdSB3B5OmOxtX/f6bZH9Jl8ng/DMIkdyu5a7gQojk8OxLmb8I i5Csx0cyB4JaAn6lgmjFcuVcPSO9qTuXx6tu8jWeMfiCzaZokzaejHDKzgln4JNCKTkHfg4 pV0padRALK2V8nD2kft1RJZy5OpSzNhBDpKRu6nWxj7li6Cc5CcLeYKUK6JOf4hUvlEpm8q s5xr8z+OzlHeOMhnhINpQ== UI-OutboundReport: notjunk:1;M01:P0:6L+gLwVLfds=;gBBWyOQsnQXWi87LoTDIf6FPTrY WzdODYpvHhOtg1sqcBRjhmyUH2Dinp268cCmLLDD8uwpDsJuDzJLQBGcvy/MiLusaLoiY+/bJ V23EpZ8N6eKyQGbHgAOabmx++m4XTIQr6bUUkAwtXBY4liV/X89hL0lCppBaqpqNmJJyYFAPt RVmVszZO02v0YOs5K8sxaFzM3fqwdk+ydW5Hg9H3NfK2orEaTk0YkmFeGAaL0c29fiJXCtW7b RGrchgDsdmRGVb1X7KCTqm81NiAPI95c1fkASLGhEumnROkidYGPH57aVDGxiXT9OD8RQY4wS Ee+wT7Xd55RYltd6td1lL5KPcjbF3CM8mkWrhNvl2WySMf8UhcAPn50h1PNewhCQbuCO3iskc lbzrSI31Ul1FoBTmhc3IqtAJgKiMDUxANA8OmSzM/DJZpuxUJsQd6MCMAsN1gZ7kEABykwOK0 7AjHJMwPy4/kAZPFyeVpZllC2QLXroZAd0C2EdrYiwi7WA4Xc9Con2It3CijQ2viuZcrlMDqy 0lMYomXcRNE9yMdS5vEies/oAy3bbKxXuihCNLrk6uiE78/RA1/xvQZNWwdvH2jKHe/hxDtbs 6WAksml0XcLgxBN5QdhirUo4mIugpFVo1kRFyM8rBHH5057dAdxHoi24DzuO5MRSlufeYoyai 4AZrPILkf3nqlaUPA8LkY2ELKqzVBl5KbJp4JKN3u1Xg56vZ9TC+aiCZSz/WFIGjbvMy2gzEW XaypnUBfqd+K7jpXxFmRjYXjuqVbt+86xK/pLGP39Z+2ODffPUKqFrXpwVfkd4CsEZ4b9ou4H sETqBzZmMbMPRjYqu4dyW3WlDAYz670iSD6xIgHEnK5TXwjiiqRDWRundgtldcq11YlvoPqK1 xk+QCZjhnPcehjiXv+acsA0VdxAfNM686EmD5QXC2G/WIocpujQnI1qnXHepAAl8bAc780Fjc hhl3bSAngaMBpVuFljwlWWVbkfs= X-Spam-Status: No, score=3.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_SBL_CSS, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Sat, 07 Oct 2023 16:40:35 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779142006604420098 X-GMAIL-MSGID: 1779142006604420098 Since 2011, the WMI subsystem is marked as orphaned, which means that a important part of platform support for modern notebooks and even desktops is receiving not enough maintenance. So i decided to take over the maintenance of the WMI subsystem. Signed-off-by: Armin Wolf --- MAINTAINERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.39.2 diff --git a/MAINTAINERS b/MAINTAINERS index 90f13281d297..ba309dea6e4e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -378,8 +378,9 @@ F: drivers/acpi/viot.c F: include/linux/acpi_viot.h ACPI WMI DRIVER +M: Armin Wolf L: platform-driver-x86@vger.kernel.org -S: Orphan +S: Maintained F: Documentation/driver-api/wmi.rst F: Documentation/wmi/ F: drivers/platform/x86/wmi.c From patchwork Sat Oct 7 23:39:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 149658 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp1145220vqo; Sat, 7 Oct 2023 16:40:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHWAy40k4lb03Nwolnm6RRITMNKMG3hpdTQRkOUXSzm+/6v0bnZ+Gzq+gdvIvJwA3C76Mj5 X-Received: by 2002:a05:6e02:f86:b0:351:52be:aafb with SMTP id v6-20020a056e020f8600b0035152beaafbmr10414062ilo.4.1696722037147; Sat, 07 Oct 2023 16:40:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696722037; cv=none; d=google.com; s=arc-20160816; b=zsW9mN9QrwC6G7YE34fwRzhnFKttuAbrG9W3AasO83MYsT3tR8tpi+ak0K++bQoW1l MkqPo23kBs0YizgB4GV0U9E/eKMvCVvUIEy9s1OePS/tls8J2lshlvy1RwgutsIBi+k3 mzspMiHbZwECRd8lWaB++3oG7uaiDo63eNueB2R7YE68UuOkF6MHTrtrQWJ8dzmhku23 Di3QH89vNFJRaRTIG7Qn8DZbS5mLnaOcYQO7nqCQngZoOFs7SgAQ1TN0TY6lIdVQmBt7 qTQKDSJEmeAXryRJH3onH6LO3j9/5vTtz3i/he3/81fgosjRlTpgHt1baZPk9R/8sxAo NhCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2bw93raK3gKIrY1VxtylG+dkg8FhRZ+WM2w1iCYEVp8=; fh=8KfVqr1qxxxqRnLLJWd1s6GBuyrXdAyRV8iNAMTuQpk=; b=ewNvN3c/FL/t8zBEkEXmzMLHpUOGjzf8qJyyyQiJwlk4LSMruA5lBAPpOlheG9o/DX 3lc9AiXPcVgAySObNTTT1wb/F/aOpPZK0lEH2vh1oWVe05s3kGFpkyWaG8ZW3GdMMr3z R7XZglkZ7pPfRvUqR2suz2i0MGahDdLCs2oYjY4tPAxdkgTSQmh7kj4jy8UfqR3og2E7 MFoC0fMESGeE9ZVY4IGa7iu/NVOZ1eRvNWbDYxsANv+TjjidilAiu8lBirtop5QsgxSV cJ/1Vnl5RnwCZl6hkAiR+GSdoSeWrCaSLlVYZ1oWxZdf0RPB0r9z7jAawKW7No2MerC+ c3cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=rgbhVzcK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id c18-20020a17090a8d1200b002743b58483asi6520495pjo.66.2023.10.07.16.40.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Oct 2023 16:40:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=rgbhVzcK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 6E27B808A41F; Sat, 7 Oct 2023 16:40:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344260AbjJGXkV (ORCPT + 17 others); Sat, 7 Oct 2023 19:40:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344273AbjJGXkJ (ORCPT ); Sat, 7 Oct 2023 19:40:09 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A289107; Sat, 7 Oct 2023 16:40:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1696721983; x=1697326783; i=w_armin@gmx.de; bh=Y/qUsDiDdVUWMFMwXVZBHFFUAPNEIq2aEjhb47CVHzI=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=rgbhVzcKBhZVzUQ7AR+KSY4IWWHkGmELyTK7wZawN0e43WjPwsT0/mGr0PPv0WeeEPuAR7Ft46g O44PKUWQOQAAexBewMYrbrhQ+eiCaPMwCkMmi/tlYGRoxIANs1/qqu1yIuz7yeHhmyOHy3p33UMEV 3f8cHPpX3kbfUHPcBqHjuweruywfLtST1C4ue2eC+F5y+TTyOxcKx98JaSLItmGfRE/UZUPrdS12u 47mrvghSJvwZ0uOK9A5YkpqDkX1YLWbUmaL+jAjsIDlvg6n7qcLgPcJwCcSey32k6vObyKCfK2iHn Q05mbeFEympJIhCNudI4i9GrWbCeIejdJzDQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from mx-amd-b650.users.agdsn.de ([141.30.226.129]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MxUnz-1rmCGd3f1F-00xvNG; Sun, 08 Oct 2023 01:39:42 +0200 From: Armin Wolf To: hdegoede@redhat.com, markgross@kernel.org, ilpo.jarvinen@linux.intel.com Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/6] platform/x86: wmi: Decouple probe deferring from wmi_block_list Date: Sun, 8 Oct 2023 01:39:29 +0200 Message-Id: <20231007233933.72121-3-W_Armin@gmx.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231007233933.72121-1-W_Armin@gmx.de> References: <20231007233933.72121-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:flITnas8bY7wHEIbBweiIIBp7vUh6aH6WVAyzKsZgXSytqzEHnw ZHSXLk3gD6SBWYtjSNEIjkTm+BqVdrCdsKBjlxHdTmFPJ+S0dmOBWk9d8VXpYN5DjyXKApJ FgEWkmqa67JMzNUbKiBfeO7ZCmflxeKaCq+9vtV+GvfwedoFmTdfBevPuOKLXzqD5QAuX83 qNR6OBV88KGpcnPCdhnDQ== UI-OutboundReport: notjunk:1;M01:P0:qxGLR2kVk5U=;htd33az+9hkprs0VwE8zAIpbw2m gTFQnOOhni7Axcehcdvb7L0J/4cqx6tMudTKUY9ifLENnyfQlU+RyB/BDfQ8Q57oxg9/88KZG 3pGWCyNVECBfvpAJd6ks3k+2KPqBwFkCFsCKlVdY72O0EexKfPssw1cVha7/7S4HnKzoFogaX Zc4F2vhM63LRcGZfI6oUfu+ork8no3wd7+NqNKGdzO9LT+ej48ghzrdXo3hHQMX1K5YyPw9Ig 19xNJGzDgEJU+1N0DsRVY5Pdx4nlIKalSD9UYFOAC4SKd2vC5UIr5VAYTaR0EJeElGSXjRHyO mO0cBnRbDpxJ1X+feAiwAdwHZ7wxHCc5R7JoSGDXjKhQV5/XuyiTNXFXESKShVDf1tHqLiMlJ DWGPqE+PBHp0Jvcu91sqWTXjD5SXS3M+EkUlG+E8GZBSnWgrQGYwEcMemfjNOQvGZGb3JD0dL pUjZaRMh41vr61upUKOCkYzYnR0CfvbP2s7OMX+CiHc1a1buV/Qj4mmHoB2vOXCQvuybZvuql 8PU8PbZh99UP9qQv4HUyWxIwP6R6/JDGuPrFs+zJBqrq1y4RZu0QQP9XZH1oFEKHZI4ljCpR5 uCBmGOiKS1aMqDFIuWESffTdu60P/9m6ItV4hUn5IFCzYGMDt3HxL2McrdhyXr9X7VMYAj3AO zNnKsG3kdLOJx7dPPseoSbtFmvHiQS/sUPgUUyCitXM40y9ZGj0skVmk5PeFrOIMxFn7qgsRi XYd3UTedX0DjqxNV4keD0ecSRHRLgw7dTHgqX9ZTAle0MYXVgnuwNLAfWVvZ4njL/xI6U4/fR JILDiPjs7x8uTUIactdVoKKpYOKaLfTRQ0tYejLkbUKOsUqMxaP6cJH3HlWlkb6KTRy5o0j69 ychnR8QXggk/zROiQ3EMPJ1jpfFIJO2SVoi7YSqFQWkXld8+atMxyu6pDYlbL8ir9QQ8+eSzh BDvjQqy4DcI2ikg7iRU4fA/LoXU= X-Spam-Status: No, score=3.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_SBL_CSS, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Sat, 07 Oct 2023 16:40:34 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779142006883607982 X-GMAIL-MSGID: 1779142006883607982 Many aggregate WMI drivers do not use -EPROBE_DEFER when they cannot find a WMI device during probe, instead they require all WMI devices associated with an platform device to become available at once. This is currently achieved by adding those WMI devices to the wmi_block_list before they are registered, which is then used by the deprecated GUID-based functions to search for WMI devices. Replace this approach with a device link which defers probing of the WMI device until the associated platform device has finished probing (and has registered all WMI devices). New aggregate WMI drivers should not rely on this behaviour. Signed-off-by: Armin Wolf --- drivers/platform/x86/wmi.c | 39 +++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) -- 2.39.2 diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index a78ddd83cda0..1dbef16acdeb 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -1221,6 +1221,26 @@ static int wmi_create_device(struct device *wmi_bus_dev, return 0; } +static int wmi_add_device(struct platform_device *pdev, struct wmi_device *wdev) +{ + struct device_link *link; + + /* + * Many aggregate WMI drivers do not use -EPROBE_DEFER when they + * are unable to find a WMI device during probe, instead they require + * all WMI devices associated with an platform device to become available + * at once. This device link thus prevents WMI drivers from probing until + * the associated platform device has finished probing (and has registered + * all discovered WMI devices). + */ + + link = device_link_add(&wdev->dev, &pdev->dev, DL_FLAG_AUTOREMOVE_SUPPLIER); + if (!link) + return -EINVAL; + + return device_add(&wdev->dev); +} + static void wmi_free_devices(struct acpi_device *device) { struct wmi_block *wblock, *next; @@ -1263,11 +1283,12 @@ static bool guid_already_parsed_for_legacy(struct acpi_device *device, const gui /* * Parse the _WDG method for the GUID data blocks */ -static int parse_wdg(struct device *wmi_bus_dev, struct acpi_device *device) +static int parse_wdg(struct device *wmi_bus_dev, struct platform_device *pdev) { + struct acpi_device *device = ACPI_COMPANION(&pdev->dev); struct acpi_buffer out = {ACPI_ALLOCATE_BUFFER, NULL}; const struct guid_block *gblock; - struct wmi_block *wblock, *next; + struct wmi_block *wblock; union acpi_object *obj; acpi_status status; int retval = 0; @@ -1317,22 +1338,14 @@ static int parse_wdg(struct device *wmi_bus_dev, struct acpi_device *device) wblock->handler = wmi_notify_debug; wmi_method_enable(wblock, true); } - } - /* - * Now that all of the devices are created, add them to the - * device tree and probe subdrivers. - */ - list_for_each_entry_safe(wblock, next, &wmi_block_list, list) { - if (wblock->acpi_device != device) - continue; - - retval = device_add(&wblock->dev.dev); + retval = wmi_add_device(pdev, &wblock->dev); if (retval) { dev_err(wmi_bus_dev, "failed to register %pUL\n", &wblock->gblock.guid); if (debug_event) wmi_method_enable(wblock, false); + list_del(&wblock->list); put_device(&wblock->dev.dev); } @@ -1487,7 +1500,7 @@ static int acpi_wmi_probe(struct platform_device *device) } dev_set_drvdata(&device->dev, wmi_bus_dev); - error = parse_wdg(wmi_bus_dev, acpi_device); + error = parse_wdg(wmi_bus_dev, device); if (error) { pr_err("Failed to parse WDG method\n"); goto err_remove_busdev; From patchwork Sat Oct 7 23:39:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 149656 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp1145147vqo; Sat, 7 Oct 2023 16:40:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGMsJnjQDgiyxoUl1E35tt2jOOtI3biSg/VFAecf3Vm2cav9+EgwUxHD8GMLjfNzitpKWBs X-Received: by 2002:a05:6870:89aa:b0:1e1:e1f8:ea3e with SMTP id f42-20020a05687089aa00b001e1e1f8ea3emr13013904oaq.1.1696722022577; Sat, 07 Oct 2023 16:40:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696722022; cv=none; d=google.com; s=arc-20160816; b=vFbTlropOcxruIZ6EhVVtHXwCTpyEH1+M828VPkbPokjwRl4laj6EtlW98J5aH5hDp Iphhr+QcyFFeow6w3F9id7XbX6BcCpSStjK5DJ/t6DJl5biaJlX+jQJZl9euTlcbZWSU RCJCnPcUb/nVFlG9gF9n3lhlglSEw4JM3kSpFciOjAgoILaAj5yaHLI/fLTzkKh+Go0Z z3QkniJcAh3/GSYGiUbAnmd5AfK5Bs5cFyleevyTq6j1UhVDMLG6eRAV8dYi9BE34jS+ ZcMNxrbWaerukWp1MCeTzIhFlrhC/B9JOBmPoV/of3laU0qTaD6bOlIQqO0ieGZfOKDA WdXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9Ook8IfyQoydJxFII3cfCezwFTXYvOl5pC/HrusLMZ0=; fh=8KfVqr1qxxxqRnLLJWd1s6GBuyrXdAyRV8iNAMTuQpk=; b=zBws0HYGBQkWuGg2LXNwUjQ7pnE9VGYRnXzYxhgHlv1J4tWvHDO9ErEhrMU5Zi3p/0 YzNXa15+fqo5hPaCuHSGg+ds7XDEW60rUQOW/5gCmnjwbBpY3J62YxhA+z+RLmZ9Xg6N dZHPMnfnYfek2M/yCwc/aXlBAmHBbNFIZEIHNmEtP+y9CaZXi3/3nb9nCv3//rTBMS4q XADw3+zy8GgAIzpoEUdXNe8m/u8ZW/P4dlN5xbQa54VrFzY7aDrn8sZf688OnGlgYrRi MzVKCLeJx2L5g0QBE3bmGr5UuWBjsngFvTtGHQGIoOYIZZKOX56I8icr4It7pQoRblTk +K3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b="GpUofq/a"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id r20-20020a170902c61400b001bb324569efsi6213451plr.364.2023.10.07.16.40.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Oct 2023 16:40:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b="GpUofq/a"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id D53818043906; Sat, 7 Oct 2023 16:40:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344237AbjJGXkM (ORCPT + 17 others); Sat, 7 Oct 2023 19:40:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344264AbjJGXkH (ORCPT ); Sat, 7 Oct 2023 19:40:07 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DFC9F4; Sat, 7 Oct 2023 16:39:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1696721987; x=1697326787; i=w_armin@gmx.de; bh=mQwZ7HovL0XAV0BMMBNTr9Ft336d/JL1LOfzD0c2oJs=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=GpUofq/aXvm6L4Hol4uEH/q4j0fHDgrqI8pj72Q2icXcTlhE1R534hZ/ykfRRD5vdxsHpiJEbZN zrkdEo36wSr6p9ivNdE7d6Skh/WGBI29MN9BqRzMkaqMHHfFc0cHo0nrM+AYcwJHly9Uzb17ivPbO Za4rA7ksQsW5ucR8QDsjBx4UgTkGghG5b/+XiNn2mcfvqJoc0WkXjOiwfTagmaSUOaWVsCc9EaAAc i0JI1ufGCgW8YLxDICYkVFink/XsAw71lPBoeCWRvCSgFTMRGwNi4WstiOJIYWDp7g3kI2uOZ3pGc YMCYNBi1Vu1jb5nREVjIU2HtNA4aCIGK3g9g== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from mx-amd-b650.users.agdsn.de ([141.30.226.129]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mw9UK-1rgxRn13BM-00s8P5; Sun, 08 Oct 2023 01:39:47 +0200 From: Armin Wolf To: hdegoede@redhat.com, markgross@kernel.org, ilpo.jarvinen@linux.intel.com Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/6] platform/x86: wmi: Fix probe failure when failing to register WMI devices Date: Sun, 8 Oct 2023 01:39:31 +0200 Message-Id: <20231007233933.72121-5-W_Armin@gmx.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231007233933.72121-1-W_Armin@gmx.de> References: <20231007233933.72121-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:9P7xsS13HCRdXoo2mkDLbWm2pkjVkLOF1PVs64A7a7WDKEt49k2 TtQBFf7YKQUTV/arre+n6fRGfFSg3SXd1I33HiTOF55GR59moVQRjU31jN2HZJ++9qa7ZXF GD8HvpMUTrJD7my4E+brtcWXlPEyvRDKjarGc2uiIKnXOH2EUxcIFsk3vWUCmyEXOXaNPxI gG5yfLXll/59vPUqK3rkg== UI-OutboundReport: notjunk:1;M01:P0:sEpCZUQHoqs=;nEHA27N2QBChWwPVv4zSmSsNhE+ 9qtFprUpplMHJSSlqS/J02RX+lQp1GRSjbai40YPGxB8Se7uJ0g7whgIlSmiwB6THC9xsN6c/ he6JLCgTbfZxddNMKOaCq5scXkBqxHj63ari2SVSMpz2nJD1DTUDkArRa6RxUdWZo+YEzZxRj S6O+JZYYcvWUBHbULnXROqEodKNEVLMBtN+Bjw6BH5qvzX885x58ipvkXD4g9cfl28Tr7voet fzQWaC6abngd4GA04TiBAktyLcO5nDFPJPzMvLMLm+6qoOYhvLv1rVEjswO4es5eakdqW5pca fdsNWlq60ttfO1BzGanPwuODsojwVlq0p+iqrm8On+H4r9Z+OwesS/UyRmrZgnM63fye3kVTg 1xa1QzCSreg+h/ShRijUmdR8PZS9Yfx7J9aPSxKYMimc57qOUJgIyXMM8wEdaYmlc1c2Zc5q4 gzO8WBodkSVKWBH15Gty3dZI/v6WTaue5hPLBi5wSOXBvMT1kSnb/joJrAEusWGIyN0UT0zx2 yjF5oeNPoGV7Tl1UpGvuDipmdWThTU4JTahkFlRLE3kVUvEvtPCv8iqUiDLBzoOlii94Ua3Cn C1aDchuz4x10xVUFRBjvdsCtq9diCUmwK+/Rmj96M0DmxIN7PhRZw17QO9X16vEEA590dDj65 h8axTHurVGIaAqnKCwIKJL8iODQx/9EI2Tus846l9HzhT1Fq4a4Rq6b5cSZPJWhFzJ9nOyYmN GZ4ZOjp3rd1rQW3noE5AtlNaFPMP3KAZDxctYj8ON/dPvsPFvk78FoGxy22uZZ5YTsL74IRd6 fz9NUljTnTF3JLFGJAvAGQq0K4jBMbjiPVdc01rNEuP9BiBQZvX8OHMXCjktXYLC7zMcuv+oF ABX7ClrIaunjwbcA6fZEphxq9bvRCJc7+7tlQebuD0TNA59FGSPZ8vKd6W06CIMr44c6LUD7b 0109KGht1T4nNtFifjbK1kZdBMI= X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sat, 07 Oct 2023 16:40:21 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779141991579927381 X-GMAIL-MSGID: 1779141991579927381 When a WMI device besides the first one somehow fails to register, retval is returned while still containing a negative error code. This causes the ACPI device failing to probe, leaving behind zombie WMI devices leading to various errors later. Fix this by handling the single error path separately and return 0 after trying to register all WMI devices. Also continue to register WMI devices even if some fail to allocate. Fixes: 6ee50aaa9a20 ("platform/x86: wmi: Instantiate all devices before adding them") Signed-off-by: Armin Wolf --- drivers/platform/x86/wmi.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) -- 2.39.2 diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index e3984801883a..ab24ea9ffc9a 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -1338,8 +1338,8 @@ static int parse_wdg(struct device *wmi_bus_dev, struct platform_device *pdev) struct wmi_block *wblock; union acpi_object *obj; acpi_status status; - int retval = 0; u32 i, total; + int retval; status = acpi_evaluate_object(device->handle, "_WDG", NULL, &out); if (ACPI_FAILURE(status)) @@ -1350,8 +1350,8 @@ static int parse_wdg(struct device *wmi_bus_dev, struct platform_device *pdev) return -ENXIO; if (obj->type != ACPI_TYPE_BUFFER) { - retval = -ENXIO; - goto out_free_pointer; + kfree(obj); + return -ENXIO; } gblock = (const struct guid_block *)obj->buffer.pointer; @@ -1366,8 +1366,8 @@ static int parse_wdg(struct device *wmi_bus_dev, struct platform_device *pdev) wblock = kzalloc(sizeof(*wblock), GFP_KERNEL); if (!wblock) { - retval = -ENOMEM; - break; + dev_err(wmi_bus_dev, "Failed to allocate %pUL\n", &gblock[i].guid); + continue; } wblock->acpi_device = device; @@ -1398,9 +1398,9 @@ static int parse_wdg(struct device *wmi_bus_dev, struct platform_device *pdev) } } -out_free_pointer: - kfree(out.pointer); - return retval; + kfree(obj); + + return 0; } /* From patchwork Sat Oct 7 23:39:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 149660 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp1145275vqo; Sat, 7 Oct 2023 16:40:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHGkyopI3QC+0bT3Y74Iw/F/y5zqMgM5NWMMhsP99KN+Drkw54A8wH957mSE4Exr3Ob+jbl X-Received: by 2002:a17:902:e88c:b0:1c4:fae:bf4a with SMTP id w12-20020a170902e88c00b001c40faebf4amr15250099plg.16.1696722051552; Sat, 07 Oct 2023 16:40:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696722051; cv=none; d=google.com; s=arc-20160816; b=sIqeOV4MjshwlfIjqNmqucovjxQyIgUmhgbALTVcI9AIRXfrDzBTB6eW+FSOSDx2q/ oSjCaFEqQP2MzfAqtafqqsGo6atuXPs8f32P7/XEG/hfKlVleJd9XuxbBzZn07mqIDmU mwQivNtb51mLfK4F4ljwx/yjogfJqPdSGI/phVM+p/CHBNlo7/FF0prLtpWHaIVq/MUX GlVYGCFzwSDa4SDnzAEXIvDAq5sbtaQiFUsAEkkGYS3wVBgc8CYenbAtBPg/r2m57tdz xWZzVZR/U7xBup655Ih1429SJMfgBwZjryRjJXfgMCpKnaKjOU78fKGE2qnQr+YkH/kg R7Rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=m5PAWXrLiAPKvZ2f9gXUhptxpHGo5hK7ZGLAWWE8kSQ=; fh=8KfVqr1qxxxqRnLLJWd1s6GBuyrXdAyRV8iNAMTuQpk=; b=DJPft2mqoFKdeCP5pX1DOl3aZ7Xo3UDnMrQGS5rGy/4xHGHi0qEiS7fqNAWLmlKGCO wHQNUF1O2cn0I0imR3VfaH/7fSklhRA8+xjyX/qqVuMW2FSZwM1Gwgk2OVua8XMqA6Qy 6ewvVmclZUU85aYfayvCiDgjDiAj+5c0EYbRaBp8TuS8cy2laYDg7hRpgLxnbKuWAuvk Kz26F5rpfpFZBf6/fjDAv6JhtB1G+8kYLe8klc0rwGXlEqPBD9t/wDrO31mXXaw1+Jez t9MVWJtUsP6D4lEx9iglV1PKrTNfmGWxXSDIPaRh1ejGcOnZrwHPB6+87ZL3KBLvtoV4 CpaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=rU1wAa3t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id w12-20020a170902c78c00b001c465e1e219si6402362pla.30.2023.10.07.16.40.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Oct 2023 16:40:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=rU1wAa3t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 723308032E40; Sat, 7 Oct 2023 16:40:46 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344279AbjJGXkJ (ORCPT + 17 others); Sat, 7 Oct 2023 19:40:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344168AbjJGXkB (ORCPT ); Sat, 7 Oct 2023 19:40:01 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35DA5BC; Sat, 7 Oct 2023 16:39:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1696721988; x=1697326788; i=w_armin@gmx.de; bh=x1THz+UVadBgvASSd3DL2MDkUZ8jlzu8RvUsxEiUFV8=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=rU1wAa3tVgT30N8/cR8PZLhZWEpjOfJbrBuNuhwUTGr+YfxqEGbEN+YxCqAsZDVd94MwA1GUMw3 CbpJBBm6kUqecNafhKAYl0McvJvecS0YElXEbZN8AeUW6bIE+ynRxE/mZAtpg/6vdrvumk1schRDd T6nyDdcbJuEnAN8xrFjmarBHI17PEHiRa3O9mDjnfDoXVXyPRyoFoQRUf6feygtRm7TwDjn8xzjAj GYlgcAICnQyifet23I5E2CHj9chCLTiNcQOJKBz/L+9/7/KqAkkdyw4OdiHDbAO2z1GTgIkObwUcR Pakz6Jow12GV0gdvm6LzcMHI960v7aO1UlBA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from mx-amd-b650.users.agdsn.de ([141.30.226.129]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MIx3I-1r9XqA1yxO-00KU5C; Sun, 08 Oct 2023 01:39:48 +0200 From: Armin Wolf To: hdegoede@redhat.com, markgross@kernel.org, ilpo.jarvinen@linux.intel.com Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/6] platform/x86: wmi: Fix opening of char device Date: Sun, 8 Oct 2023 01:39:32 +0200 Message-Id: <20231007233933.72121-6-W_Armin@gmx.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231007233933.72121-1-W_Armin@gmx.de> References: <20231007233933.72121-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:mOK/zZxrBq1zuij9wGiY+7APjMNgMMyQ07Txqx8cpnsGO6OYvYn mYROyP8H0cW/DJz4i8b8ovoVjiXgxeLe1RR0grNqslMdKcEzu6yVk9DSachTlA0L9Bd1MU5 cOTXnC+TG1xXM+1iD6k9nL0kCfAbGiy6I6o55AmtA0WY8Z61SZNE5P/FuD+wmhZvK84X3b+ 4usD3ZVlvqhDvuXJDIasA== UI-OutboundReport: notjunk:1;M01:P0:qdfl4deJgvc=;pZDGz6DqR3H/O/ZZWbkPaHrYWUq 4cfteMYsbvM+NZLJwcCsWxCjo/o+RCP78D7FlFB6bjdCYz6tCABvmaFsxW2EvPwpmtXDSoVCw wZB8Z6z2FmCqBPxnSC+21bapGdgPIs+PvGTth5uGxOVeZRSdZdK+mbp40U+6cHCP4fguzjiMV tCadcHqKBUi5n4Zl9zQyZsvKw3bKYMeKwC1APEU0wV6PhVJtZA1BRYkvfObFOw6mL54pqCOUK QO73RkmsTSMLgv3b7hgFD4PIDONNNp2uoIbFxvKKPCGLWIIdeIWKASarWS/zsT0LXgs9XFV3c uLv8LGGYAu6rpGJKPSdmXzruT7KlPY8uoM3wZujLwUN4oKSBSLcljDLUFFJry95I/l0Jm02cy XU/Mok23ZsGxQ0GU1dEajkJEYx5w+qsvs6pjvoQ5KltjO7hw6RbG7Gr9DGZBripKBTOG2dm0e 51P88KxL7fF2uy43QQZtV6FDgzeFWONOksrrIXJTsYs2Pn3SZbghvhihGkIIDSHB5QWvkNW53 7/IUwVoI8dcrOiX4nH/b472cyhR08zDwhR6JfeWty/3qFAuuStTJzb2RNzjIcId69nk79KNI2 ocA1UGEuIKdJ6InU5qDmSMwimGyncJiVM8wbdLo6blf4D1+LWoIFNAdhXxMgaq/iveOgPj0EH jxfhLNX07/VdTOm3VcNEJRocHjG9D2rUoaFULFBt0n9SXV21/PscWL69DI1cxih64K9IiYcJz iC5SWBfW5uFOXHphy5HmFUfXju5/UYF/c0rykg5ZhWGqhPyJeVpj6kXDYiibiXEAOYJzbP2hr YYcedjapxJigb7zks3/YSb7QfHClzae1mhNpTEH+G0eiuC2PHffBjzEdKQny+wkPYYTAfPDkz SqibBjj7YOLgcdnWLf1uQf//tNiseZrYLi6mCbl8bylq6VgpEXJI02T3dYq67kYkjiYufNd/b LXLL6M8V571ROLAjtEHrkFfAkPY= X-Spam-Status: No, score=3.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_SBL_CSS, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Sat, 07 Oct 2023 16:40:46 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779142021710142769 X-GMAIL-MSGID: 1779142021710142769 Since commit fa1f68db6ca7 ("drivers: misc: pass miscdevice pointer via file private data"), the miscdevice stores a pointer to itself inside filp->private_data, which means that private_data will not be NULL when wmi_char_open() is called. This might cause memory corruption should wmi_char_open() be unable to find its driver, something which can happen when the associated WMI device is deleted in wmi_free_devices(). Fix this by using the miscdevice pointer to retrieve the WMI device data associated with a char device using container_of(). This also avoids wmi_char_open() picking a wrong WMI device bound to a driver with the same name as the original driver. Fixes: 44b6b7661132 ("platform/x86: wmi: create userspace interface for drivers") Signed-off-by: Armin Wolf --- drivers/platform/x86/wmi.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) -- 2.39.2 diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index ab24ea9ffc9a..6b3b2fe464d2 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -958,21 +958,13 @@ static int wmi_dev_match(struct device *dev, struct device_driver *driver) } static int wmi_char_open(struct inode *inode, struct file *filp) { - const char *driver_name = filp->f_path.dentry->d_iname; - struct wmi_block *wblock; - struct wmi_block *next; - - list_for_each_entry_safe(wblock, next, &wmi_block_list, list) { - if (!wblock->dev.dev.driver) - continue; - if (strcmp(driver_name, wblock->dev.dev.driver->name) == 0) { - filp->private_data = wblock; - break; - } - } + /* + * The miscdevice already stores a pointer to itself + * inside filp->private_data + */ + struct wmi_block *wblock = container_of(filp->private_data, struct wmi_block, char_dev); - if (!filp->private_data) - return -ENODEV; + filp->private_data = wblock; return nonseekable_open(inode, filp); }