Skip to contentSkip to conversation

Revert "drm/amdgpu: Fix NULL dereference in dpm sysfs handlers"

PATCH In review Alex Deucher 3 participants 6 messages Oct 14, 2020 – Oct 16, 2020

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

PATCH 1/1 Revert "drm/amdgpu: Fix NULL dereference in dpm sysfs handlers"

This regressed some working configurations so revert it. Will fix this properly for 5.9 and backport then.

This reverts commit 38e0c89a19fd13f28d2b4721035160a3e66e270b.

This needs to be applied to 5.9 as well. -next (5.10) has this already, but 5.9 missed it.

(cherry picked from commit 87004abfbc27261edd15716515d89ab42198b405)
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +6 -3
index e4dbf14320b6..5bf4212d2857 100644
@@ -796,7 +796,8 @@ static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev,
 		tmp_str++;
 	while (isspace(*++tmp_str));
 
-	while ((sub_str = strsep(&tmp_str, delimiter)) != NULL) {
+	while (tmp_str[0]) {
+		sub_str = strsep(&tmp_str, delimiter);
 		ret = kstrtol(sub_str, 0, &parameter[parameter_size]);
 		if (ret)
 			return -EINVAL;
@@ -1066,7 +1067,8 @@ static ssize_t amdgpu_read_mask(const char *buf, size_t count, uint32_t *mask)
 	memcpy(buf_cpy, buf, bytes);
 	buf_cpy[bytes] = '\0';
 	tmp = buf_cpy;
-	while ((sub_str = strsep(&tmp, delimiter)) != NULL) {
+	while (tmp[0]) {
+		sub_str = strsep(&tmp, delimiter);
 		if (strlen(sub_str)) {
 			ret = kstrtol(sub_str, 0, &level);
 			if (ret)
@@ -1695,7 +1697,8 @@ static ssize_t amdgpu_set_pp_power_profile_mode(struct device *dev,
 			i++;
 		memcpy(buf_cpy, buf, count-i);
 		tmp_str = buf_cpy;
-		while ((sub_str = strsep(&tmp_str, delimiter)) != NULL) {
+		while (tmp_str[0]) {
+			sub_str = strsep(&tmp_str, delimiter);
 			ret = kstrtol(sub_str, 0, &parameter[parameter_size]);
 			if (ret)
 				return -EINVAL;
Signature · 1 line
2.25.4
maintainer
#1 lore raw
Quoted 2 lines · Alex Deucher

This regressed some working configurations so revert it. Will fix this properly for 5.9 and backport then.

What do you mean "backport then"?

Quoted 5 lines

This reverts commit 38e0c89a19fd13f28d2b4721035160a3e66e270b.

This needs to be applied to 5.9 as well. -next (5.10) has this already, but 5.9 missed it.

What is the real fix for this? Is it in Linus's tree and I can just backport that fix?

thanks,

greg k-h

#2 lore raw

[AMD Public Use]

Quoted 16 lines

-----Original Message-----
From: Greg KH <[email protected]>
Sent: Thursday, October 15, 2020 1:15 AM
To: Alex Deucher <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] Revert "drm/amdgpu: Fix NULL dereference in dpm sysfs handlers"

Quoted 2 lines · Alex Deucher

This regressed some working configurations so revert it. Will fix this properly for 5.9 and backport then.

What do you mean "backport then"?

Quoted 1 line
Quoted 8 lines
Quoted 4 lines

This reverts commit 38e0c89a19fd13f28d2b4721035160a3e66e270b.

This needs to be applied to 5.9 as well. -next (5.10) has this already, but 5.9 missed it.

What is the real fix for this? Is it in Linus's tree and I can just backport that fix?

This is no real fix. The revert is the fix. Sorry, I should have clarified that.

Thanks,

Alex

Quoted 3 lines

thanks,

greg k-h

maintainer
#3 lore raw
Quoted 20 lines · Alexander

[AMD Public Use]

Quoted 18 lines

-----Original Message-----
From: Greg KH <[email protected]>
Sent: Thursday, October 15, 2020 1:15 AM
To: Alex Deucher <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] Revert "drm/amdgpu: Fix NULL dereference in dpm sysfs handlers"

Quoted 2 lines · Alex Deucher

This regressed some working configurations so revert it. Will fix this properly for 5.9 and backport then.

What do you mean "backport then"?

Quoted 3 lines

This reverts commit 38e0c89a19fd13f28d2b4721035160a3e66e270b.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

This needs to be applied to 5.9 as well. -next (5.10) has this already, but 5.9 missed it.

What is the real fix for this? Is it in Linus's tree and I can just backport that fix?

This is no real fix. The revert is the fix. Sorry, I should have clarified that.

Is it also reverted in Linus's tree? If so, what's that commit id?

If not, shouldn't it be?

thanks,

greg k-h

#4 lore raw

[AMD Public Use]

Quoted 36 lines

-----Original Message-----
From: Greg KH <[email protected]>
Sent: Thursday, October 15, 2020 10:06 AM
To: Deucher, Alexander <[email protected]>
Cc: Alex Deucher <[email protected]>; [email protected]
Subject: Re: [PATCH] Revert "drm/amdgpu: Fix NULL dereference in dpm sysfs handlers"

Quoted 27 lines · Alexander

[AMD Public Use]

Quoted 24 lines

-----Original Message-----
From: Greg KH <[email protected]>
Sent: Thursday, October 15, 2020 1:15 AM
To: Alex Deucher <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] Revert "drm/amdgpu: Fix NULL dereference in dpm sysfs handlers"

Quoted 2 lines · Alex Deucher

This regressed some working configurations so revert it. Will fix this properly for 5.9 and backport then.

What do you mean "backport then"?

Quoted 5 lines

This reverts commit 38e0c89a19fd13f28d2b4721035160a3e66e270b.

This needs to be applied to 5.9 as well. -next (5.10) has this already, but 5.9 missed it.

What is the real fix for this? Is it in Linus's tree and I can just backport that fix?

Quoted 5 lines
Quoted 1 line

This is no real fix. The revert is the fix. Sorry, I should have clarified that.

Is it also reverted in Linus's tree? If so, what's that commit id?

If not, shouldn't it be?

It is reverted in Linus' tree. I cherry-picked the revert from Linus' tree:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=87004abfbc27261edd15716515d89ab42198b405

Alex

Quoted 4 lines

thanks,

greg k-h

maintainer
#5 lore raw
Quoted 38 lines · Alexander

[AMD Public Use]

Quoted 36 lines

-----Original Message-----
From: Greg KH <[email protected]>
Sent: Thursday, October 15, 2020 10:06 AM
To: Deucher, Alexander <[email protected]>
Cc: Alex Deucher <[email protected]>; [email protected]
Subject: Re: [PATCH] Revert "drm/amdgpu: Fix NULL dereference in dpm sysfs handlers"

Quoted 27 lines · Alexander

[AMD Public Use]

Quoted 24 lines

-----Original Message-----
From: Greg KH <[email protected]>
Sent: Thursday, October 15, 2020 1:15 AM
To: Alex Deucher <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] Revert "drm/amdgpu: Fix NULL dereference in dpm sysfs handlers"

Quoted 2 lines · Alex Deucher

This regressed some working configurations so revert it. Will fix this properly for 5.9 and backport then.

What do you mean "backport then"?

Quoted 5 lines

This reverts commit 38e0c89a19fd13f28d2b4721035160a3e66e270b.

This needs to be applied to 5.9 as well. -next (5.10) has this already, but 5.9 missed it.

What is the real fix for this? Is it in Linus's tree and I can just backport that fix?

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

This is no real fix. The revert is the fix. Sorry, I should have clarified that.

Is it also reverted in Linus's tree? If so, what's that commit id?

If not, shouldn't it be?

It is reverted in Linus' tree. I cherry-picked the revert from Linus' tree:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=87004abfbc27261edd15716515d89ab42198b405

Ok, I've queued that one up now, can you also send me versions of this for the older kernel trees that need it (I think 4.19.y and 5.4.y).

thanks,

greg k-h