* Re: [PATCH 6.1.y] drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini()
2024-12-05 8:43 jianqi.ren.cn
@ 2024-12-05 8:40 ` Greg KH
2024-12-05 13:34 ` Sasha Levin
1 sibling, 0 replies; 14+ messages in thread
From: Greg KH @ 2024-12-05 8:40 UTC (permalink / raw)
To: jianqi.ren.cn; +Cc: n.zhandarovich, stable
On Thu, Dec 05, 2024 at 04:43:29PM +0800, jianqi.ren.cn@windriver.com wrote:
> From: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
>
> Since 'adev->dm.dc' in amdgpu_dm_fini() might turn out to be NULL
> before the call to dc_enable_dmub_notifications(), check
> beforehand to ensure there will not be a possible NULL-ptr-deref
> there.
>
> Also, since commit 1e88eb1b2c25 ("drm/amd/display: Drop
> CONFIG_DRM_AMD_DC_HDCP") there are two separate checks for NULL in
> 'adev->dm.dc' before dc_deinit_callbacks() and dc_dmub_srv_destroy().
> Clean up by combining them all under one 'if'.
>
> Found by Linux Verification Center (linuxtesting.org) with static
> analysis tool SVACE.
>
> Fixes: 81927e2808be ("drm/amd/display: Support for DMUB AUX")
> Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> Signed-off-by: Jianqi Ren <jianqi.ren.cn@windriver.com>
> ---
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
No upstream git id :(
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 6.1.y] drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini()
@ 2024-12-05 8:43 jianqi.ren.cn
2024-12-05 8:40 ` Greg KH
2024-12-05 13:34 ` Sasha Levin
0 siblings, 2 replies; 14+ messages in thread
From: jianqi.ren.cn @ 2024-12-05 8:43 UTC (permalink / raw)
To: n.zhandarovich, gregkh; +Cc: stable
From: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Since 'adev->dm.dc' in amdgpu_dm_fini() might turn out to be NULL
before the call to dc_enable_dmub_notifications(), check
beforehand to ensure there will not be a possible NULL-ptr-deref
there.
Also, since commit 1e88eb1b2c25 ("drm/amd/display: Drop
CONFIG_DRM_AMD_DC_HDCP") there are two separate checks for NULL in
'adev->dm.dc' before dc_deinit_callbacks() and dc_dmub_srv_destroy().
Clean up by combining them all under one 'if'.
Found by Linux Verification Center (linuxtesting.org) with static
analysis tool SVACE.
Fixes: 81927e2808be ("drm/amd/display: Support for DMUB AUX")
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jianqi Ren <jianqi.ren.cn@windriver.com>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 8dc0f70df24f..7b4d44dcb343 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -1882,14 +1882,14 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev)
dc_deinit_callbacks(adev->dm.dc);
#endif
- if (adev->dm.dc)
+ if (adev->dm.dc) {
dc_dmub_srv_destroy(&adev->dm.dc->ctx->dmub_srv);
-
- if (dc_enable_dmub_notifications(adev->dm.dc)) {
- kfree(adev->dm.dmub_notify);
- adev->dm.dmub_notify = NULL;
- destroy_workqueue(adev->dm.delayed_hpd_wq);
- adev->dm.delayed_hpd_wq = NULL;
+ if (dc_enable_dmub_notifications(adev->dm.dc)) {
+ kfree(adev->dm.dmub_notify);
+ adev->dm.dmub_notify = NULL;
+ destroy_workqueue(adev->dm.delayed_hpd_wq);
+ adev->dm.delayed_hpd_wq = NULL;
+ }
}
if (adev->dm.dmub_bo)
--
2.25.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 6.1.y] drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini()
2024-12-05 8:43 jianqi.ren.cn
2024-12-05 8:40 ` Greg KH
@ 2024-12-05 13:34 ` Sasha Levin
1 sibling, 0 replies; 14+ messages in thread
From: Sasha Levin @ 2024-12-05 13:34 UTC (permalink / raw)
To: stable; +Cc: jianqi.ren.cn, Sasha Levin
[ Sasha's backport helper bot ]
Hi,
Found matching upstream commit: 2a3cfb9a24a28da9cc13d2c525a76548865e182c
WARNING: Author mismatch between patch and found commit:
Backport author: <jianqi.ren.cn@windriver.com>
Commit author: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Status in newer kernel trees:
6.12.y | Present (exact SHA1)
6.11.y | Present (exact SHA1)
6.6.y | Present (different SHA1: e040f1fbe9ab)
6.1.y | Not found
Note: The patch differs from the upstream commit:
---
1: 2a3cfb9a24a28 ! 1: df938a35abd76 drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini()
@@ Commit message
Fixes: 81927e2808be ("drm/amd/display: Support for DMUB AUX")
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+ Signed-off-by: Jianqi Ren <jianqi.ren.cn@windriver.com>
## drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c ##
@@ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c: static void amdgpu_dm_fini(struct amdgpu_device *adev)
- adev->dm.hdcp_workqueue = NULL;
- }
+ dc_deinit_callbacks(adev->dm.dc);
+ #endif
- if (adev->dm.dc)
+ if (adev->dm.dc) {
- dc_deinit_callbacks(adev->dm.dc);
--
-- if (adev->dm.dc)
dc_dmub_srv_destroy(&adev->dm.dc->ctx->dmub_srv);
-
- if (dc_enable_dmub_notifications(adev->dm.dc)) {
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.1.y | Success | Success |
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 6.1.y] drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini()
@ 2024-12-06 3:31 jianqi.ren.cn
2024-12-06 17:11 ` Sasha Levin
2024-12-11 8:14 ` Greg KH
0 siblings, 2 replies; 14+ messages in thread
From: jianqi.ren.cn @ 2024-12-06 3:31 UTC (permalink / raw)
To: n.zhandarovich, gregkh; +Cc: stable
From: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
[ Upstream commit 2a3cfb9a24a28da9cc13d2c525a76548865e182c ]
Since 'adev->dm.dc' in amdgpu_dm_fini() might turn out to be NULL
before the call to dc_enable_dmub_notifications(), check
beforehand to ensure there will not be a possible NULL-ptr-deref
there.
Also, since commit 1e88eb1b2c25 ("drm/amd/display: Drop
CONFIG_DRM_AMD_DC_HDCP") there are two separate checks for NULL in
'adev->dm.dc' before dc_deinit_callbacks() and dc_dmub_srv_destroy().
Clean up by combining them all under one 'if'.
Found by Linux Verification Center (linuxtesting.org) with static
analysis tool SVACE.
Fixes: 81927e2808be ("drm/amd/display: Support for DMUB AUX")
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jianqi Ren <jianqi.ren.cn@windriver.com>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 8dc0f70df24f..7b4d44dcb343 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -1882,14 +1882,14 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev)
dc_deinit_callbacks(adev->dm.dc);
#endif
- if (adev->dm.dc)
+ if (adev->dm.dc) {
dc_dmub_srv_destroy(&adev->dm.dc->ctx->dmub_srv);
-
- if (dc_enable_dmub_notifications(adev->dm.dc)) {
- kfree(adev->dm.dmub_notify);
- adev->dm.dmub_notify = NULL;
- destroy_workqueue(adev->dm.delayed_hpd_wq);
- adev->dm.delayed_hpd_wq = NULL;
+ if (dc_enable_dmub_notifications(adev->dm.dc)) {
+ kfree(adev->dm.dmub_notify);
+ adev->dm.dmub_notify = NULL;
+ destroy_workqueue(adev->dm.delayed_hpd_wq);
+ adev->dm.delayed_hpd_wq = NULL;
+ }
}
if (adev->dm.dmub_bo)
--
2.25.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 6.1.y] drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini()
2024-12-06 3:31 [PATCH 6.1.y] drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini() jianqi.ren.cn
@ 2024-12-06 17:11 ` Sasha Levin
2024-12-11 8:14 ` Greg KH
1 sibling, 0 replies; 14+ messages in thread
From: Sasha Levin @ 2024-12-06 17:11 UTC (permalink / raw)
To: stable; +Cc: jianqi.ren.cn, Sasha Levin
[ Sasha's backport helper bot ]
Hi,
The upstream commit SHA1 provided is correct: 2a3cfb9a24a28da9cc13d2c525a76548865e182c
WARNING: Author mismatch between patch and upstream commit:
Backport author: <jianqi.ren.cn@windriver.com>
Commit author: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Status in newer kernel trees:
6.12.y | Present (exact SHA1)
6.6.y | Present (different SHA1: e040f1fbe9ab)
6.1.y | Not found
Note: The patch differs from the upstream commit:
---
1: 2a3cfb9a24a28 ! 1: da3cc3fa89a29 drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini()
@@ Metadata
## Commit message ##
drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini()
+ [ Upstream commit 2a3cfb9a24a28da9cc13d2c525a76548865e182c ]
+
Since 'adev->dm.dc' in amdgpu_dm_fini() might turn out to be NULL
before the call to dc_enable_dmub_notifications(), check
beforehand to ensure there will not be a possible NULL-ptr-deref
@@ Commit message
Fixes: 81927e2808be ("drm/amd/display: Support for DMUB AUX")
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+ Signed-off-by: Jianqi Ren <jianqi.ren.cn@windriver.com>
## drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c ##
@@ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c: static void amdgpu_dm_fini(struct amdgpu_device *adev)
- adev->dm.hdcp_workqueue = NULL;
- }
+ dc_deinit_callbacks(adev->dm.dc);
+ #endif
- if (adev->dm.dc)
+ if (adev->dm.dc) {
- dc_deinit_callbacks(adev->dm.dc);
--
-- if (adev->dm.dc)
dc_dmub_srv_destroy(&adev->dm.dc->ctx->dmub_srv);
-
- if (dc_enable_dmub_notifications(adev->dm.dc)) {
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.1.y | Success | Success |
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 6.1.y] drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini()
@ 2024-12-09 6:41 jianqi.ren.cn
2024-12-09 14:35 ` Sasha Levin
0 siblings, 1 reply; 14+ messages in thread
From: jianqi.ren.cn @ 2024-12-09 6:41 UTC (permalink / raw)
To: wayne.lin, gregkh
Cc: stable, harry.wentland, sunpeng.li, Rodrigo.Siqueira,
alexander.deucher, christian.koenig, airlied, daniel, Jerry.Zuo,
amd-gfx, dri-devel, linux-kernel, sashal, alex.hung,
mario.limonciello, chiahsuan.chung, hersenxs.wu, n.zhandarovich,
shenshih, Nicholas.Kazlauskas, hanghong.ma
From: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
[ Upstream commit 2a3cfb9a24a28da9cc13d2c525a76548865e182c ]
Since 'adev->dm.dc' in amdgpu_dm_fini() might turn out to be NULL
before the call to dc_enable_dmub_notifications(), check
beforehand to ensure there will not be a possible NULL-ptr-deref
there.
Also, since commit 1e88eb1b2c25 ("drm/amd/display: Drop
CONFIG_DRM_AMD_DC_HDCP") there are two separate checks for NULL in
'adev->dm.dc' before dc_deinit_callbacks() and dc_dmub_srv_destroy().
Clean up by combining them all under one 'if'.
Found by Linux Verification Center (linuxtesting.org) with static
analysis tool SVACE.
Fixes: 81927e2808be ("drm/amd/display: Support for DMUB AUX")
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jianqi Ren <jianqi.ren.cn@windriver.com>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 8dc0f70df24f..7b4d44dcb343 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -1882,14 +1882,14 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev)
dc_deinit_callbacks(adev->dm.dc);
#endif
- if (adev->dm.dc)
+ if (adev->dm.dc) {
dc_dmub_srv_destroy(&adev->dm.dc->ctx->dmub_srv);
-
- if (dc_enable_dmub_notifications(adev->dm.dc)) {
- kfree(adev->dm.dmub_notify);
- adev->dm.dmub_notify = NULL;
- destroy_workqueue(adev->dm.delayed_hpd_wq);
- adev->dm.delayed_hpd_wq = NULL;
+ if (dc_enable_dmub_notifications(adev->dm.dc)) {
+ kfree(adev->dm.dmub_notify);
+ adev->dm.dmub_notify = NULL;
+ destroy_workqueue(adev->dm.delayed_hpd_wq);
+ adev->dm.delayed_hpd_wq = NULL;
+ }
}
if (adev->dm.dmub_bo)
--
2.25.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 6.1.y] drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini()
2024-12-09 6:41 jianqi.ren.cn
@ 2024-12-09 14:35 ` Sasha Levin
0 siblings, 0 replies; 14+ messages in thread
From: Sasha Levin @ 2024-12-09 14:35 UTC (permalink / raw)
To: stable; +Cc: jianqi.ren.cn, Sasha Levin
[ Sasha's backport helper bot ]
Hi,
The upstream commit SHA1 provided is correct: 2a3cfb9a24a28da9cc13d2c525a76548865e182c
WARNING: Author mismatch between patch and upstream commit:
Backport author: <jianqi.ren.cn@windriver.com>
Commit author: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Status in newer kernel trees:
6.12.y | Present (exact SHA1)
6.6.y | Present (different SHA1: e040f1fbe9ab)
6.1.y | Not found
Note: The patch differs from the upstream commit:
---
1: 2a3cfb9a24a28 ! 1: 16b03dc13bb4e drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini()
@@ Metadata
## Commit message ##
drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini()
+ [ Upstream commit 2a3cfb9a24a28da9cc13d2c525a76548865e182c ]
+
Since 'adev->dm.dc' in amdgpu_dm_fini() might turn out to be NULL
before the call to dc_enable_dmub_notifications(), check
beforehand to ensure there will not be a possible NULL-ptr-deref
@@ Commit message
Fixes: 81927e2808be ("drm/amd/display: Support for DMUB AUX")
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+ Signed-off-by: Jianqi Ren <jianqi.ren.cn@windriver.com>
## drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c ##
@@ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c: static void amdgpu_dm_fini(struct amdgpu_device *adev)
- adev->dm.hdcp_workqueue = NULL;
- }
+ dc_deinit_callbacks(adev->dm.dc);
+ #endif
- if (adev->dm.dc)
+ if (adev->dm.dc) {
- dc_deinit_callbacks(adev->dm.dc);
--
-- if (adev->dm.dc)
dc_dmub_srv_destroy(&adev->dm.dc->ctx->dmub_srv);
-
- if (dc_enable_dmub_notifications(adev->dm.dc)) {
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.1.y | Success | Success |
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 6.1.y] drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini()
2024-12-06 3:31 [PATCH 6.1.y] drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini() jianqi.ren.cn
2024-12-06 17:11 ` Sasha Levin
@ 2024-12-11 8:14 ` Greg KH
1 sibling, 0 replies; 14+ messages in thread
From: Greg KH @ 2024-12-11 8:14 UTC (permalink / raw)
To: jianqi.ren.cn; +Cc: n.zhandarovich, stable
On Fri, Dec 06, 2024 at 11:31:19AM +0800, jianqi.ren.cn@windriver.com wrote:
> From: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
>
> [ Upstream commit 2a3cfb9a24a28da9cc13d2c525a76548865e182c ]
Please cc: all relevant people on backports.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 6.1.y] drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini()
@ 2024-12-11 9:56 jianqi.ren.cn
2024-12-11 16:33 ` Sasha Levin
0 siblings, 1 reply; 14+ messages in thread
From: jianqi.ren.cn @ 2024-12-11 9:56 UTC (permalink / raw)
To: n.zhandarovich, wayne.lin, gregkh
Cc: alexander.deucher, stable, harry.wentland, sunpeng.li,
Rodrigo.Siqueira, christian.koenig, airlied, daniel, Jerry.Zuo,
amd-gfx, dri-devel, linux-kernel, sashal, alex.hung,
mario.limonciello, chiahsuan.chung, hersenxs.wu, shenshih,
Nicholas.Kazlauskas, hanghong.ma
From: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
[ Upstream commit 2a3cfb9a24a28da9cc13d2c525a76548865e182c ]
Since 'adev->dm.dc' in amdgpu_dm_fini() might turn out to be NULL
before the call to dc_enable_dmub_notifications(), check
beforehand to ensure there will not be a possible NULL-ptr-deref
there.
Also, since commit 1e88eb1b2c25 ("drm/amd/display: Drop
CONFIG_DRM_AMD_DC_HDCP") there are two separate checks for NULL in
'adev->dm.dc' before dc_deinit_callbacks() and dc_dmub_srv_destroy().
Clean up by combining them all under one 'if'.
Found by Linux Verification Center (linuxtesting.org) with static
analysis tool SVACE.
Fixes: 81927e2808be ("drm/amd/display: Support for DMUB AUX")
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jianqi Ren <jianqi.ren.cn@windriver.com>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 8dc0f70df24f..7b4d44dcb343 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -1882,14 +1882,14 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev)
dc_deinit_callbacks(adev->dm.dc);
#endif
- if (adev->dm.dc)
+ if (adev->dm.dc) {
dc_dmub_srv_destroy(&adev->dm.dc->ctx->dmub_srv);
-
- if (dc_enable_dmub_notifications(adev->dm.dc)) {
- kfree(adev->dm.dmub_notify);
- adev->dm.dmub_notify = NULL;
- destroy_workqueue(adev->dm.delayed_hpd_wq);
- adev->dm.delayed_hpd_wq = NULL;
+ if (dc_enable_dmub_notifications(adev->dm.dc)) {
+ kfree(adev->dm.dmub_notify);
+ adev->dm.dmub_notify = NULL;
+ destroy_workqueue(adev->dm.delayed_hpd_wq);
+ adev->dm.delayed_hpd_wq = NULL;
+ }
}
if (adev->dm.dmub_bo)
--
2.25.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 6.1.y] drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini()
@ 2024-12-11 10:15 jianqi.ren.cn
2024-12-11 16:33 ` Sasha Levin
0 siblings, 1 reply; 14+ messages in thread
From: jianqi.ren.cn @ 2024-12-11 10:15 UTC (permalink / raw)
To: n.zhandarovich, wayne.lin, gregkh
Cc: patches, alexander.deucher, stable, harry.wentland, sunpeng.li,
Rodrigo.Siqueira, christian.koenig, airlied, daniel, Jerry.Zuo,
amd-gfx, dri-devel, linux-kernel, sashal, alex.hung,
mario.limonciello, chiahsuan.chung, hersenxs.wu, shenshih,
Nicholas.Kazlauskas, hanghong.ma
From: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
[ Upstream commit 2a3cfb9a24a28da9cc13d2c525a76548865e182c ]
Since 'adev->dm.dc' in amdgpu_dm_fini() might turn out to be NULL
before the call to dc_enable_dmub_notifications(), check
beforehand to ensure there will not be a possible NULL-ptr-deref
there.
Also, since commit 1e88eb1b2c25 ("drm/amd/display: Drop
CONFIG_DRM_AMD_DC_HDCP") there are two separate checks for NULL in
'adev->dm.dc' before dc_deinit_callbacks() and dc_dmub_srv_destroy().
Clean up by combining them all under one 'if'.
Found by Linux Verification Center (linuxtesting.org) with static
analysis tool SVACE.
Fixes: 81927e2808be ("drm/amd/display: Support for DMUB AUX")
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jianqi Ren <jianqi.ren.cn@windriver.com>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 8dc0f70df24f..7b4d44dcb343 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -1882,14 +1882,14 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev)
dc_deinit_callbacks(adev->dm.dc);
#endif
- if (adev->dm.dc)
+ if (adev->dm.dc) {
dc_dmub_srv_destroy(&adev->dm.dc->ctx->dmub_srv);
-
- if (dc_enable_dmub_notifications(adev->dm.dc)) {
- kfree(adev->dm.dmub_notify);
- adev->dm.dmub_notify = NULL;
- destroy_workqueue(adev->dm.delayed_hpd_wq);
- adev->dm.delayed_hpd_wq = NULL;
+ if (dc_enable_dmub_notifications(adev->dm.dc)) {
+ kfree(adev->dm.dmub_notify);
+ adev->dm.dmub_notify = NULL;
+ destroy_workqueue(adev->dm.delayed_hpd_wq);
+ adev->dm.delayed_hpd_wq = NULL;
+ }
}
if (adev->dm.dmub_bo)
--
2.25.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 6.1.y] drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini()
2024-12-11 9:56 jianqi.ren.cn
@ 2024-12-11 16:33 ` Sasha Levin
0 siblings, 0 replies; 14+ messages in thread
From: Sasha Levin @ 2024-12-11 16:33 UTC (permalink / raw)
To: stable; +Cc: jianqi.ren.cn, Sasha Levin
[ Sasha's backport helper bot ]
Hi,
The upstream commit SHA1 provided is correct: 2a3cfb9a24a28da9cc13d2c525a76548865e182c
WARNING: Author mismatch between patch and upstream commit:
Backport author: <jianqi.ren.cn@windriver.com>
Commit author: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Status in newer kernel trees:
6.12.y | Present (exact SHA1)
6.6.y | Present (different SHA1: e040f1fbe9ab)
6.1.y | Not found
Note: The patch differs from the upstream commit:
---
1: 2a3cfb9a24a28 ! 1: 06214c2883f65 drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini()
@@ Metadata
## Commit message ##
drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini()
+ [ Upstream commit 2a3cfb9a24a28da9cc13d2c525a76548865e182c ]
+
Since 'adev->dm.dc' in amdgpu_dm_fini() might turn out to be NULL
before the call to dc_enable_dmub_notifications(), check
beforehand to ensure there will not be a possible NULL-ptr-deref
@@ Commit message
Fixes: 81927e2808be ("drm/amd/display: Support for DMUB AUX")
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+ Signed-off-by: Jianqi Ren <jianqi.ren.cn@windriver.com>
## drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c ##
@@ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c: static void amdgpu_dm_fini(struct amdgpu_device *adev)
- adev->dm.hdcp_workqueue = NULL;
- }
+ dc_deinit_callbacks(adev->dm.dc);
+ #endif
- if (adev->dm.dc)
+ if (adev->dm.dc) {
- dc_deinit_callbacks(adev->dm.dc);
--
-- if (adev->dm.dc)
dc_dmub_srv_destroy(&adev->dm.dc->ctx->dmub_srv);
-
- if (dc_enable_dmub_notifications(adev->dm.dc)) {
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.1.y | Success | Success |
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 6.1.y] drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini()
2024-12-11 10:15 jianqi.ren.cn
@ 2024-12-11 16:33 ` Sasha Levin
0 siblings, 0 replies; 14+ messages in thread
From: Sasha Levin @ 2024-12-11 16:33 UTC (permalink / raw)
To: stable; +Cc: jianqi.ren.cn, Sasha Levin
[ Sasha's backport helper bot ]
Hi,
The upstream commit SHA1 provided is correct: 2a3cfb9a24a28da9cc13d2c525a76548865e182c
WARNING: Author mismatch between patch and upstream commit:
Backport author: <jianqi.ren.cn@windriver.com>
Commit author: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Status in newer kernel trees:
6.12.y | Present (exact SHA1)
6.6.y | Present (different SHA1: e040f1fbe9ab)
6.1.y | Not found
Note: The patch differs from the upstream commit:
---
1: 2a3cfb9a24a28 ! 1: d2c2f56b0642e drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini()
@@ Metadata
## Commit message ##
drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini()
+ [ Upstream commit 2a3cfb9a24a28da9cc13d2c525a76548865e182c ]
+
Since 'adev->dm.dc' in amdgpu_dm_fini() might turn out to be NULL
before the call to dc_enable_dmub_notifications(), check
beforehand to ensure there will not be a possible NULL-ptr-deref
@@ Commit message
Fixes: 81927e2808be ("drm/amd/display: Support for DMUB AUX")
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+ Signed-off-by: Jianqi Ren <jianqi.ren.cn@windriver.com>
## drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c ##
@@ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c: static void amdgpu_dm_fini(struct amdgpu_device *adev)
- adev->dm.hdcp_workqueue = NULL;
- }
+ dc_deinit_callbacks(adev->dm.dc);
+ #endif
- if (adev->dm.dc)
+ if (adev->dm.dc) {
- dc_deinit_callbacks(adev->dm.dc);
--
-- if (adev->dm.dc)
dc_dmub_srv_destroy(&adev->dm.dc->ctx->dmub_srv);
-
- if (dc_enable_dmub_notifications(adev->dm.dc)) {
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.1.y | Success | Success |
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 6.1.y] drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini()
@ 2025-01-26 6:44 Imkanmod Khan
2025-01-26 17:22 ` Sasha Levin
0 siblings, 1 reply; 14+ messages in thread
From: Imkanmod Khan @ 2025-01-26 6:44 UTC (permalink / raw)
To: stable
Cc: patches, n.zhandarovich, alexander.deucher, wayne.lin, gregkh,
harry.wentland, sunpeng.li, Rodrigo.Siqueira, christian.koenig,
airlied, daniel, Jerry.Zuo, amd-gfx, dri-devel, linux-kernel,
sashal, alex.hung, mario.limonciello, chiahsuan.chung,
hersenxs.wu, shenshih, Nicholas.Kazlauskas, hanghong.ma,
Imkanmod Khan
From: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
[ Upstream commit 2a3cfb9a24a28da9cc13d2c525a76548865e182c ]
Since 'adev->dm.dc' in amdgpu_dm_fini() might turn out to be NULL
before the call to dc_enable_dmub_notifications(), check
beforehand to ensure there will not be a possible NULL-ptr-deref
there.
Also, since commit 1e88eb1b2c25 ("drm/amd/display: Drop
CONFIG_DRM_AMD_DC_HDCP") there are two separate checks for NULL in
'adev->dm.dc' before dc_deinit_callbacks() and dc_dmub_srv_destroy().
Clean up by combining them all under one 'if'.
Found by Linux Verification Center (linuxtesting.org) with static
analysis tool SVACE.
Fixes: 81927e2808be ("drm/amd/display: Support for DMUB AUX")
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
[ To fix CVE-2024-27041, I fix the merge conflict by still using macro
CONFIG_DRM_AMD_DC_HDCP in the first adev->dm.dc check. ]
Signed-off-by: Imkanmod Khan <imkanmodkhan@gmail.com>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 8dc0f70df24f..7b4d44dcb343 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -1882,14 +1882,14 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev)
dc_deinit_callbacks(adev->dm.dc);
#endif
- if (adev->dm.dc)
+ if (adev->dm.dc) {
dc_dmub_srv_destroy(&adev->dm.dc->ctx->dmub_srv);
-
- if (dc_enable_dmub_notifications(adev->dm.dc)) {
- kfree(adev->dm.dmub_notify);
- adev->dm.dmub_notify = NULL;
- destroy_workqueue(adev->dm.delayed_hpd_wq);
- adev->dm.delayed_hpd_wq = NULL;
+ if (dc_enable_dmub_notifications(adev->dm.dc)) {
+ kfree(adev->dm.dmub_notify);
+ adev->dm.dmub_notify = NULL;
+ destroy_workqueue(adev->dm.delayed_hpd_wq);
+ adev->dm.delayed_hpd_wq = NULL;
+ }
}
if (adev->dm.dmub_bo)
--
2.25.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 6.1.y] drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini()
2025-01-26 6:44 Imkanmod Khan
@ 2025-01-26 17:22 ` Sasha Levin
0 siblings, 0 replies; 14+ messages in thread
From: Sasha Levin @ 2025-01-26 17:22 UTC (permalink / raw)
To: stable; +Cc: Imkanmod Khan, Sasha Levin
[ Sasha's backport helper bot ]
Hi,
The upstream commit SHA1 provided is correct: 2a3cfb9a24a28da9cc13d2c525a76548865e182c
WARNING: Author mismatch between patch and upstream commit:
Backport author: Imkanmod Khan<imkanmodkhan@gmail.com>
Commit author: Nikita Zhandarovich<n.zhandarovich@fintech.ru>
Status in newer kernel trees:
6.12.y | Present (exact SHA1)
6.6.y | Present (different SHA1: e040f1fbe9ab)
6.1.y | Not found
Note: The patch differs from the upstream commit:
---
1: 2a3cfb9a24a28 ! 1: 62480a5656c9a drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini()
@@ Metadata
## Commit message ##
drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini()
+ [ Upstream commit 2a3cfb9a24a28da9cc13d2c525a76548865e182c ]
+
Since 'adev->dm.dc' in amdgpu_dm_fini() might turn out to be NULL
before the call to dc_enable_dmub_notifications(), check
beforehand to ensure there will not be a possible NULL-ptr-deref
@@ Commit message
Fixes: 81927e2808be ("drm/amd/display: Support for DMUB AUX")
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+ [ To fix CVE-2024-27041, I fix the merge conflict by still using macro
+ CONFIG_DRM_AMD_DC_HDCP in the first adev->dm.dc check. ]
+ Signed-off-by: Imkanmod Khan <imkanmodkhan@gmail.com>
## drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c ##
@@ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c: static void amdgpu_dm_fini(struct amdgpu_device *adev)
- adev->dm.hdcp_workqueue = NULL;
- }
+ dc_deinit_callbacks(adev->dm.dc);
+ #endif
- if (adev->dm.dc)
+ if (adev->dm.dc) {
- dc_deinit_callbacks(adev->dm.dc);
--
-- if (adev->dm.dc)
dc_dmub_srv_destroy(&adev->dm.dc->ctx->dmub_srv);
-
- if (dc_enable_dmub_notifications(adev->dm.dc)) {
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.1.y | Success | Success |
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2025-01-26 17:22 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-06 3:31 [PATCH 6.1.y] drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini() jianqi.ren.cn
2024-12-06 17:11 ` Sasha Levin
2024-12-11 8:14 ` Greg KH
-- strict thread matches above, loose matches on Subject: below --
2025-01-26 6:44 Imkanmod Khan
2025-01-26 17:22 ` Sasha Levin
2024-12-11 10:15 jianqi.ren.cn
2024-12-11 16:33 ` Sasha Levin
2024-12-11 9:56 jianqi.ren.cn
2024-12-11 16:33 ` Sasha Levin
2024-12-09 6:41 jianqi.ren.cn
2024-12-09 14:35 ` Sasha Levin
2024-12-05 8:43 jianqi.ren.cn
2024-12-05 8:40 ` Greg KH
2024-12-05 13:34 ` Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox