Potential BUG: [PATCH 2/8] drm/amdgpu: add a generic fb accessing helper function(v3)
Iago Abal
iago.abal at gmail.com
Sat Nov 16 16:21:37 UTC 2019
Hi,
With the help of a static bug finder (EBA - https://github.com/IagoAbal/eba)
I have found a potential double lock in Linux Next tag next-20191115, file
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c.
This bug seems to be introduced by commit
e35e2b117f4 ("drm/amdgpu: add a generic fb accessing helper function(v3)").
The steps to reproduce it would be:
1. Start in function `amdgpu_device_vram_access`.
2. Enter for-loop `for (last += pos; pos <= last; pos += 4)`.
3. First lock: `spin_lock_irqsave(&adev->mmio_idx_lock, flags)`.
4. Call to `WREG32_NO_KIQ(mmMM_INDEX, ((uint32_t)pos) | 0x80000000)`.
5. Note `#define WREG32_NO_KIQ(reg, v) amdgpu_mm_wreg(adev, (reg), (v),
AMDGPU_REGS_NO_KIQ)`.
6. Continue in function `amdgpu_mm_wreg`.
7. Take else-branch in the third if-statement.
8. Double lock: `spin_lock_irqsave(&adev->mmio_idx_lock, flags)`.
I think the control flow could reach that second lock, but you may know
better.
Hope it helps!
-- iago
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20191116/5ddad325/attachment.html>
More information about the amd-gfx
mailing list