Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp1002958rdb; Fri, 9 Feb 2024 07:32:56 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWocWxvCiQSYgIMaTmMu4phNT8r4kEjwjk8kc2WLBchZAU5C3kbL73G6Wgqe+2HhaxnmIkGmW4ceTQs/47zRK45P1XK8XtAQxiTagsNyQ== X-Google-Smtp-Source: AGHT+IGNvRG2VMnSDA+lSP8Hqk+9w7ITH6aphxdpgJMd/WGgXTZEOMzKU56fmrGnmbLTIotIGNmU X-Received: by 2002:a05:6359:4591:b0:176:cf18:d0bb with SMTP id no17-20020a056359459100b00176cf18d0bbmr2130885rwb.13.1707492776368; Fri, 09 Feb 2024 07:32:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707492776; cv=pass; d=google.com; s=arc-20160816; b=L0heIhWqK5FmhiGkIsNVyISboh+0n/x+geSBCcB4gp6E3rV0uczr07G8LP2NzVyrT5 kGzfOIU+eWrfGMDeOSZQ7EUtwMmrPD4I7r2Ikc/6pOZdr7iNruK8rVk4dO1pSGdEzHot tgNIDvFz7DNEkeNx1kOtk8xCL/954ID9RjUMP+SfvaNT87zDWIGfryuLkeH5cqMC1R7+ OyxbGjp2p4kH0ZD4hZV0NDcXhbwtrCnfUGm+4U/tx+//f6IPGl1KdaYjJBAD7Bx8h1hb OFPXkY8dE8amNmdO21kynmfz7BSdRZ87SM8P2tbfAG0wYmL6NSApQzIP2EVtUK2tzpgY NcxQ== 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=t+UUJr5N4jQHpUSki3y/skiH2R5J83EEcjOZFEnAPsw=; b=fhgkuoiOXM0SUSpUY5swycTl6r2JLt1icgAYZZGeDjddJk+yVH1BbZijn5SYyXiaW8 5evxvez4ICiBr4KffmL63jiFKTniIFlE2sxE46sM/9NVXvOahJ01rZkJ6w7c4THrGmtb I1VHRY32uAFExY+2k2wWOfqG18GBk5dSZBqNEPtD+8+l/No82tUaL/ei6Gv7rF1kQV3r +S5w2E7a91n/EgGz0aM+0D38D0tHWEju5TQQZwdjgWJctxqp+OhN/+ybg77YFkXfSrv1 WQUfaGi0n694n1m68Uv/Vu/n5FjwU11tx4dtf4NF0/e8jELey0c044xBWAC25XSjkwYt QYYQ==; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59529-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCXSwSQMe7zwj4dzv8aAFqg7OFfKvMMsQApv31R/56Y5S1CDuecxQazNFlHcxLVVFaiy92+SGEphy49zf4ER0hLzsowvnlCofJjLvFH1oQ== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id s68-20020a635e47000000b005dc488101c7si1900122pgb.333.2024.02.09.07.32.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 07:32:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59529-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59529-linux.lists.archive=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id C99F8B27004 for ; Fri, 9 Feb 2024 15:24:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EC36A74E0D; Fri, 9 Feb 2024 15:23:50 +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 Content-Transfer-Encoding: 8bit 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 --- 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;", -- 2.43.0