From patchwork Fri Feb 9 15:23:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mark Pearson X-Patchwork-Id: 198949 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp928600dyd; Fri, 9 Feb 2024 07:25:40 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV9cfgAu0PHOeN0fAZH2KYvKuHWOd5pHpQ3dIlPXHDvj+sQndfTsFQQLIs4D5/hf+OfeOM58bgct76JS2APC3U37LX1Ww== X-Google-Smtp-Source: AGHT+IGZiLO4RqV/gfsZwRBM94yr/vWGwEP3unc0ES15AGKy1TJ39+GpsHK15Fw2BuWjW0X2nl2b X-Received: by 2002:a17:902:650d:b0:1d9:c2c4:c619 with SMTP id b13-20020a170902650d00b001d9c2c4c619mr1981483plk.53.1707492339963; Fri, 09 Feb 2024 07:25:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707492339; cv=pass; d=google.com; s=arc-20160816; b=CF8sOb6bPXkApXvlMRsYFpviS0hVuAzqFghkkDFzkzzYnQV13u1sxJ4kTWwu1CKsEO 9C92Va44HLXBtrHPrnZjIlOtOXEJNwMYwQzh9xAukox4sZ5yjksoNeZFMWOiu82c9Xfg 3bn42PDuiNfvvbeU73kTdSLJXE+06jHSAiAiCoL8c80dq9/JAud/k9ysTsqvZvj3eDUW nwtz1BamVlVvySIkyz00cNbkwd9mANtlCW0DHonslUWVGFxbrVmghlvrVmp3pXn0XtVR jmf4qUxf+UdkGgj+w2BOd4dT4FxOfntrQfvkHEIJ7CyhfTPeve7UcaQpzupIoKFPZZqx tIMw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:feedback-id:dkim-signature:dkim-signature; bh=joYfk4S7PqfM2niyx8PZjn01Ae11B6QrPcjL7gY/O9k=; fh=lSUCbxiiyekycEx20X0OC8KhdJF2MfAg/u+/qw8t0l8=; b=KTebM/jAKGOuvBZNyUuJ7yVqZVRX+yktrrS7bXu41IcHjAJxbgMsvy6F2I7es0tmTx 3ZAo/ngychAlWeMlsF1XffzDBu2ETFD0e+pF//dtQ2tkzHZIG8BloxVbH9JiDj9ksuB/ Gni2Z1A0Dn09CYDmg34PxZuODMRgK4KY884g71hwy/4/MbOCjthpBxTeBgVzTY1DSIJq ZjWSw8Kt0uN18pMNNfTTNzfKK7rBVvWTExPLqKE5PrjeWsQ796RX28E5+68+C65iILUS SubhOp67ot24kvI8fPby0Dd0OmkLorseIWMtFjTJl5rZf7eL5x7uuFxwQvJ4NvCRkEbA w49Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@squebb.ca header.s=fm1 header.b=FVA4XC2d; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b="hn9//HTc"; arc=pass (i=1 spf=pass spfdomain=squebb.ca dkim=pass dkdomain=squebb.ca dkim=pass dkdomain=messagingengine.com); spf=pass (google.com: domain of linux-kernel+bounces-59529-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59529-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCVH1lcaZTvYccuD+zLkxdDMaHfK+iVXMd+XPs+4BViijR9CLOuwbSQaHT+tS87+v0hXsaIJYpMLJ3XdUYpcaN48v3Ux7w== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id b12-20020a170902d30c00b001d9158d0776si1747770plc.84.2024.02.09.07.25.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 07:25:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59529-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@squebb.ca header.s=fm1 header.b=FVA4XC2d; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b="hn9//HTc"; arc=pass (i=1 spf=pass spfdomain=squebb.ca dkim=pass dkdomain=squebb.ca dkim=pass dkdomain=messagingengine.com); spf=pass (google.com: domain of linux-kernel+bounces-59529-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59529-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5F9042844E4 for ; Fri, 9 Feb 2024 15:24:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 910F874E2B; Fri, 9 Feb 2024 15:23:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=squebb.ca header.i=@squebb.ca header.b="FVA4XC2d"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="hn9//HTc" Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E992F71B34; Fri, 9 Feb 2024 15:23:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707492229; cv=none; b=IqfpDrhlBM8gNELcj805Bu6C+JPXJX/v+zu/+i9OmOjyS/quKb+riz2XUmZ1XB2SY068Uz5sGZCbVup2qTHzcIEYZFS40Aw1+yil8Y5jMWMru+4SUyknGPAgIchtGsivqCFA5bMeBwSDq1UzVlhdc65ICbMnOgmJmDuS+Ru/9tQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707492229; c=relaxed/simple; bh=WHb6VFhTlmidZTsOn/qpnzXsJ8oAzSMB+3Ur5jn8AM8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=V80m/qcQh1kzyRkYxVYxlroeebyWIEYuzfEsAKWUEQA6zJstF9ZU8e+VVhpAK3z5hULstt70vPlB0NAZcK/SkrKMKbqKNIjrCnDzI9M7ttX/O1g+lkOE6CIzG8xlJBXeETG0d7otXaPF2aPNAEBNORAEQC3qC90idEYdqFo0ZIc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=squebb.ca; spf=pass smtp.mailfrom=squebb.ca; dkim=pass (2048-bit key) header.d=squebb.ca header.i=@squebb.ca header.b=FVA4XC2d; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=hn9//HTc; arc=none smtp.client-ip=64.147.123.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=squebb.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=squebb.ca Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id B30A83200A95; Fri, 9 Feb 2024 10:23:45 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Fri, 09 Feb 2024 10:23:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=squebb.ca; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm1; t=1707492225; x= 1707578625; bh=joYfk4S7PqfM2niyx8PZjn01Ae11B6QrPcjL7gY/O9k=; b=F VA4XC2d+coe/gjSS6H8c55iVJ7nEYaujtJviYsZNX2E014/mgIbtjMmsc4fJM6Ew T5rJuECxi2RXX6Vt17TzMgNa9PkpdBO8aNQMPb3sUeJa3z+/6p4UFF2lLkHH2orv lE1/1OUiTSMVYG5Dj4BVdtFH1z6vd5D8BagwTrMYCch2XExm4cCW68Czc4Suhr1c ppsqtWewE5cVRbQvx/MLVZNRAfOlr94Q3nM85J13GASgZfzsC4/DXCuXxPTNGSic nR21kI+IDEJSchJ/Y0hDf2RV/BFJ3mcyaRnQvtf2kNCOS/e09ovkWGHeTMzaui0C PspV5pfwyFtNYAqan1Xag== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1707492225; x= 1707578625; bh=joYfk4S7PqfM2niyx8PZjn01Ae11B6QrPcjL7gY/O9k=; b=h n9//HTcKgoAESKHqnch2C2IwGxL2ma08gABRbQ+7aL/Stl+dOXZkKkkeZ0CkyNG3 EsHtBpSY7qN4mfzdRK185yXgPyX5RExgrsCMMvWH1mw+abxAKZVzqvHwY0VUGpY4 PuYsn/vzW33vI/59IruPAEuCToobRL28CubUeyTtwQyqm8TZwm+/W8eseLqpWevR /4yxKgWViaHceK0KgJSd5uQXfg3dAr4vbCbB8AX77mpXkCKkIIfF0YBwsK1dG+zM HnD4g8y2SX69vHq3NZep2VDrzamf7rwM8PK7fy7LskzQOv4emQiH5frrVWRUKxh9 FoKvPY2c7jXz/kTNZSyXg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrtdeigdejgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecuogetfedtuddqtdduucdludehmdenucfjughrpefhvf evufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforghrkhcurfgvrghrshho nhcuoehmphgvrghrshhonhdqlhgvnhhovhhosehsqhhuvggssgdrtggrqeenucggtffrrg htthgvrhhnpeeftddvjeefleffvefhgfejjeehudetteeigeeugfekhffhgeejudeuteeh gfdvffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmphgvrghrshhonhdqlhgvnhhovhhosehsqhhuvggssgdrtggr X-ME-Proxy: Feedback-ID: ibe194615:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 9 Feb 2024 10:23:44 -0500 (EST) From: Mark Pearson To: mpearson-lenovo@squebb.ca Cc: ilpo.jarvinen@linux.intel.com, hdegoede@redhat.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] platform/x86: think-lmi: Fix password opcode ordering for workstations Date: Fri, 9 Feb 2024 10:23:47 -0500 Message-ID: <20240209152359.528919-1-mpearson-lenovo@squebb.ca> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790435488138619920 X-GMAIL-MSGID: 1790435488138619920 The Lenovo workstations require the password opcode to be run before the attribute value is changed (if Admin password is enabled). Tested on some Thinkpads to confirm they are OK with this order too. Signed-off-by: Mark Pearson Reviewed-by: Ilpo Järvinen --- drivers/platform/x86/think-lmi.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c index 3a396b763c49..ce3e08815a8e 100644 --- a/drivers/platform/x86/think-lmi.c +++ b/drivers/platform/x86/think-lmi.c @@ -1009,7 +1009,16 @@ static ssize_t current_value_store(struct kobject *kobj, * Note - this sets the variable and then the password as separate * WMI calls. Function tlmi_save_bios_settings will error if the * password is incorrect. + * Workstation's require the opcode to be set before changing the + * attribute. */ + if (tlmi_priv.pwd_admin->valid && tlmi_priv.pwd_admin->password[0]) { + ret = tlmi_opcode_setting("WmiOpcodePasswordAdmin", + tlmi_priv.pwd_admin->password); + if (ret) + goto out; + } + set_str = kasprintf(GFP_KERNEL, "%s,%s;", setting->display_name, new_setting); if (!set_str) { @@ -1021,17 +1030,10 @@ static ssize_t current_value_store(struct kobject *kobj, if (ret) goto out; - if (tlmi_priv.save_mode == TLMI_SAVE_BULK) { + if (tlmi_priv.save_mode == TLMI_SAVE_BULK) tlmi_priv.save_required = true; - } else { - if (tlmi_priv.pwd_admin->valid && tlmi_priv.pwd_admin->password[0]) { - ret = tlmi_opcode_setting("WmiOpcodePasswordAdmin", - tlmi_priv.pwd_admin->password); - if (ret) - goto out; - } + else ret = tlmi_save_bios_settings(""); - } } else { /* old non-opcode based authentication method (deprecated) */ if (tlmi_priv.pwd_admin->valid && tlmi_priv.pwd_admin->password[0]) { auth_str = kasprintf(GFP_KERNEL, "%s,%s,%s;",