[PATCH] drm/amdgpu: fix NULL err for sriov detect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Reviewed-by: Alex Deucher <alexander.deucher at amd.com>


________________________________
From: amd-gfx <amd-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx> on behalf of Chunming Zhou <david1.zhou at amd.com>
Sent: Wednesday, December 13, 2017 4:03 AM
To: amd-gfx at lists.freedesktop.org
Cc: Zhou, David(ChunMing); Liu, Monk
Subject: [PATCH] drm/amdgpu: fix NULL err for sriov detect

[   21.841536] BUG: KASAN: null-ptr-deref in soc15_set_ip_blocks+0x4f/0x2e0 [amdgpu]

Change-Id: I182dfed95c362123a75feafe44fa2ad3f3f35cac
Signed-off-by: Chunming Zhou <david1.zhou at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/soc15.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c
index a16e8d9a8fa2..49ff552cd6fe 100644
--- a/drivers/gpu/drm/amd/amdgpu/soc15.c
+++ b/drivers/gpu/drm/amd/amdgpu/soc15.c
@@ -521,6 +521,11 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev)
                 return -EINVAL;
         }

+       if (adev->flags & AMD_IS_APU)
+               adev->nbio_funcs = &nbio_v7_0_funcs;
+       else
+               adev->nbio_funcs = &nbio_v6_1_funcs;
+
         adev->nbio_funcs->detect_hw_virt(adev);

         if (amdgpu_sriov_vf(adev))
@@ -611,11 +616,6 @@ static int soc15_common_early_init(void *handle)

         adev->asic_funcs = &soc15_asic_funcs;

-       if (adev->flags & AMD_IS_APU)
-               adev->nbio_funcs = &nbio_v7_0_funcs;
-       else
-               adev->nbio_funcs = &nbio_v6_1_funcs;
-
         if (amdgpu_get_ip_block(adev, AMD_IP_BLOCK_TYPE_PSP) &&
                 (amdgpu_ip_block_mask & (1 << AMD_IP_BLOCK_TYPE_PSP)))
                 psp_enabled = true;
--
2.14.1

_______________________________________________
amd-gfx mailing list
amd-gfx at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20171213/35394365/attachment-0001.html>


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux