diff mbox series

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

Message ID 20201014202836.240347-1-alexander.deucher@amd.com
State New
Headers show
Series Revert "drm/amdgpu: Fix NULL dereference in dpm sysfs handlers" | expand

Commit Message

Alex Deucher Oct. 14, 2020, 8:28 p.m. UTC
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.

Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1334
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org # 5.9.x
(cherry picked from commit 87004abfbc27261edd15716515d89ab42198b405)
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Greg KH Oct. 15, 2020, 5:14 a.m. UTC | #1
On Wed, Oct 14, 2020 at 04:28:36PM -0400, Alex Deucher wrote:
> This regressed some working configurations so revert it.  Will
> fix this properly for 5.9 and backport then.

What do you mean "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.

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

thanks,

greg k-h
Deucher, Alexander Oct. 15, 2020, 1:18 p.m. UTC | #2
[AMD Public Use]

> -----Original Message-----
> From: Greg KH <gregkh@linuxfoundation.org>
> Sent: Thursday, October 15, 2020 1:15 AM
> To: Alex Deucher <alexdeucher@gmail.com>
> Cc: stable@vger.kernel.org; Deucher, Alexander
> <Alexander.Deucher@amd.com>
> Subject: Re: [PATCH] Revert "drm/amdgpu: Fix NULL dereference in dpm
> sysfs handlers"
> 
> On Wed, Oct 14, 2020 at 04:28:36PM -0400, Alex Deucher wrote:
> > This regressed some working configurations so revert it.  Will fix
> > this properly for 5.9 and backport then.
> 
> What do you mean "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.
> 
> 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

> thanks,
> 
> greg k-h
Greg KH Oct. 15, 2020, 2:06 p.m. UTC | #3
On Thu, Oct 15, 2020 at 01:18:34PM +0000, Deucher, Alexander wrote:
> [AMD Public Use]
> 
> > -----Original Message-----
> > From: Greg KH <gregkh@linuxfoundation.org>
> > Sent: Thursday, October 15, 2020 1:15 AM
> > To: Alex Deucher <alexdeucher@gmail.com>
> > Cc: stable@vger.kernel.org; Deucher, Alexander
> > <Alexander.Deucher@amd.com>
> > Subject: Re: [PATCH] Revert "drm/amdgpu: Fix NULL dereference in dpm
> > sysfs handlers"
> > 
> > On Wed, Oct 14, 2020 at 04:28:36PM -0400, Alex Deucher wrote:
> > > This regressed some working configurations so revert it.  Will fix
> > > this properly for 5.9 and backport then.
> > 
> > What do you mean "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.
> > 
> > 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
Deucher, Alexander Oct. 15, 2020, 2:11 p.m. UTC | #4
[AMD Public Use]

> -----Original Message-----
> From: Greg KH <gregkh@linuxfoundation.org>
> Sent: Thursday, October 15, 2020 10:06 AM
> To: Deucher, Alexander <Alexander.Deucher@amd.com>
> Cc: Alex Deucher <alexdeucher@gmail.com>; stable@vger.kernel.org
> Subject: Re: [PATCH] Revert "drm/amdgpu: Fix NULL dereference in dpm
> sysfs handlers"
>
> On Thu, Oct 15, 2020 at 01:18:34PM +0000, Deucher, Alexander wrote:
> > [AMD Public Use]
> >
> > > -----Original Message-----
> > > From: Greg KH <gregkh@linuxfoundation.org>
> > > Sent: Thursday, October 15, 2020 1:15 AM
> > > To: Alex Deucher <alexdeucher@gmail.com>
> > > Cc: stable@vger.kernel.org; Deucher, Alexander
> > > <Alexander.Deucher@amd.com>
> > > Subject: Re: [PATCH] Revert "drm/amdgpu: Fix NULL dereference in dpm
> > > sysfs handlers"
> > >
> > > On Wed, Oct 14, 2020 at 04:28:36PM -0400, Alex Deucher wrote:
> > > > This regressed some working configurations so revert it.  Will fix
> > > > this properly for 5.9 and backport then.
> > >
> > > What do you mean "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.
> > >
> > > 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?

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

>
> thanks,
>
> greg k-h
Greg KH Oct. 16, 2020, 7:43 a.m. UTC | #5
On Thu, Oct 15, 2020 at 02:11:17PM +0000, Deucher, Alexander wrote:
> [AMD Public Use]

> 

> > -----Original Message-----

> > From: Greg KH <gregkh@linuxfoundation.org>

> > Sent: Thursday, October 15, 2020 10:06 AM

> > To: Deucher, Alexander <Alexander.Deucher@amd.com>

> > Cc: Alex Deucher <alexdeucher@gmail.com>; stable@vger.kernel.org

> > Subject: Re: [PATCH] Revert "drm/amdgpu: Fix NULL dereference in dpm

> > sysfs handlers"

> >

> > On Thu, Oct 15, 2020 at 01:18:34PM +0000, Deucher, Alexander wrote:

> > > [AMD Public Use]

> > >

> > > > -----Original Message-----

> > > > From: Greg KH <gregkh@linuxfoundation.org>

> > > > Sent: Thursday, October 15, 2020 1:15 AM

> > > > To: Alex Deucher <alexdeucher@gmail.com>

> > > > Cc: stable@vger.kernel.org; Deucher, Alexander

> > > > <Alexander.Deucher@amd.com>

> > > > Subject: Re: [PATCH] Revert "drm/amdgpu: Fix NULL dereference in dpm

> > > > sysfs handlers"

> > > >

> > > > On Wed, Oct 14, 2020 at 04:28:36PM -0400, Alex Deucher wrote:

> > > > > This regressed some working configurations so revert it.  Will fix

> > > > > this properly for 5.9 and backport then.

> > > >

> > > > What do you mean "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.

> > > >

> > > > 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?

> 

> 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
diff mbox series

Patch

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index e4dbf14320b6..5bf4212d2857 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -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;