Skip to contentSkip to conversation

platform/x86: dell-wmi-sysman: Change user experience when Admin/System Password is modified

PATCH In review Prasanth KSR 3 participants 4 messages Jun 28, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/x86: dell-wmi-sysman: Change user experience when Admin/System Password is modified

Whenever user has changed an Admin/System Password using the sysfs, then we are automatically copying the new password to existing password field.

---
 .../x86/dell/dell-wmi-sysman/passwordattr-interface.c         | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/dell/dell-wmi-sysman/passwordattr-interface.c +2 -2
index 339a082d6c18..86ec962aace9 100644
@@ -95,9 +95,9 @@ int set_new_password(const char *password_type, const char *new)
 
 	print_hex_dump_bytes("set new password data: ", DUMP_PREFIX_NONE, buffer, buffer_size);
 	ret = call_password_interface(wmi_priv.password_attr_wdev, buffer, buffer_size);
-	/* clear current_password here and use user input from wmi_priv.current_password */
+	/* on success copy the new password to current password */
 	if (!ret)
-		memset(current_password, 0, MAX_BUFF);
+		strscpy(current_password, new, MAX_BUFF);
 	/* explain to user the detailed failure reason */
 	else if (ret == -EOPNOTSUPP)
 		dev_err(&wmi_priv.password_attr_wdev->dev, "admin password must be configured\n");
Signature · 1 line
2.25.1
#1 lore raw

Hi,

Quoted 7 lines · Prasanth KSR

Whenever user has changed an Admin/System Password using the sysfs, then we are automatically copying the new password to existing password field.

Thank you.

I assume this was tested? The reason I'm asking because in the Lenovo Think* case it turned out that the modified password only becomes active after a reboot, so the right thing to do there was to just keep current_password as is.

Regards,

Hans

Quoted 21 lines
---
 .../x86/dell/dell-wmi-sysman/passwordattr-interface.c         | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/dell/dell-wmi-sysman/passwordattr-interface.c +2 -2
index 339a082d6c18..86ec962aace9 100644
@@ -95,9 +95,9 @@ int set_new_password(const char *password_type, const char *new)
 
 	print_hex_dump_bytes("set new password data: ", DUMP_PREFIX_NONE, buffer, buffer_size);
 	ret = call_password_interface(wmi_priv.password_attr_wdev, buffer, buffer_size);
-	/* clear current_password here and use user input from wmi_priv.current_password */
+	/* on success copy the new password to current password */
 	if (!ret)
-		memset(current_password, 0, MAX_BUFF);
+		strscpy(current_password, new, MAX_BUFF);
 	/* explain to user the detailed failure reason */
 	else if (ret == -EOPNOTSUPP)
 		dev_err(&wmi_priv.password_attr_wdev->dev, "admin password must be configured\n");
maintainer
#2 lore raw

Hi,

Quoted 22 lines

-----Original Message-----
From: Hans de Goede <[email protected]>
Sent: Monday, June 28, 2021 2:32 PM
To: Prasanth KSR; [email protected]
Cc: LKML; [email protected]; Ksr, Prasanth; Bharathi, Divya
Subject: Re: [PATCH] platform/x86: dell-wmi-sysman: Change user experience when Admin/System Password is modified

[EXTERNAL EMAIL]

Hi,

Quoted 7 lines · Prasanth KSR

Whenever user has changed an Admin/System Password using the sysfs, then we are automatically copying the new password to existing password field.

Quoted 6 lines

Thank you.

I assume this was tested? The reason I'm asking because in the Lenovo Think* case it turned out that the modified password only becomes active after a reboot, so the right thing to do there was to just keep current_password as is.

Yes it is tested and Dell BIOS Admin/System password do not require a reboot to be active.

Quoted 37 lines

Regards,

Hans

Quoted 13 lines
---
 .../x86/dell/dell-wmi-sysman/passwordattr-interface.c         | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/passwordattr-interface.c b/drivers/platform/x86/dell/dell-wmi-sysman/passwordattr-interface.c index 339a082d6c18..86ec962aace9 100644
---
a/drivers/platform/x86/dell/dell-wmi-sysman/passwordattr-interface.c +++ b/drivers/platform/x86/dell/dell-wmi-sysman/passwordattr-interface +++ .c

Review int set_new_password(const char *password_type, · line 97

Quoted 3 lines
(quoted diff) +0 -0
@@ -95,9 +95,9 @@ int set_new_password(const char *password_type,
 const char *new)
 
 	print_hex_dump_bytes("set new password data: ", DUMP_PREFIX_NONE,

buffer, buffer_size);

Review int set_new_password(const char *password_type, · line 98

Quoted 1 line
(quoted diff) +0 -0
 	ret = call_password_interface(wmi_priv.password_attr_wdev, buffer,

buffer_size);

Review int set_new_password(const char *password_type, · line 99

Quoted 1 line
(quoted diff) +0 -1
-	/* clear current_password here and use user input from

wmi_priv.current_password */

Quoted 7 lines
drivers/platform/x86/dell/dell-wmi-sysman/passwordattr-interface.c +2 -1
+	/* on success copy the new password to current password */
 	if (!ret)
-		memset(current_password, 0, MAX_BUFF);
+		strscpy(current_password, new, MAX_BUFF);
 	/* explain to user the detailed failure reason */
 	else if (ret == -EOPNOTSUPP)

dev_err(&wmi_priv.password_attr_wdev->dev, "admin password

must be

Quoted 2 lines

configured\n");

#3 lore raw
In reply to Prasanth KSR

Hi,

Quoted 7 lines · Prasanth KSR

Whenever user has changed an Admin/System Password using the sysfs, then we are automatically copying the new password to existing password field.

Thank you for your patch, I've applied this patch to my review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be added to the platform-drivers-x86/for-next branch and eventually will be included in the pdx86 pull-request to Linus for the next merge-window.

Regards,

Hans

Quoted 21 lines
---
 .../x86/dell/dell-wmi-sysman/passwordattr-interface.c         | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/dell/dell-wmi-sysman/passwordattr-interface.c +2 -2
index 339a082d6c18..86ec962aace9 100644
@@ -95,9 +95,9 @@ int set_new_password(const char *password_type, const char *new)
 
 	print_hex_dump_bytes("set new password data: ", DUMP_PREFIX_NONE, buffer, buffer_size);
 	ret = call_password_interface(wmi_priv.password_attr_wdev, buffer, buffer_size);
-	/* clear current_password here and use user input from wmi_priv.current_password */
+	/* on success copy the new password to current password */
 	if (!ret)
-		memset(current_password, 0, MAX_BUFF);
+		strscpy(current_password, new, MAX_BUFF);
 	/* explain to user the detailed failure reason */
 	else if (ret == -EOPNOTSUPP)
 		dev_err(&wmi_priv.password_attr_wdev->dev, "admin password must be configured\n");