From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: "Jack Xiao" <Jack.Xiao@amd.com>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Hawking Zhang" <Hawking.Zhang@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"Sasha Levin" <sashal@kernel.org>,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: [PATCH AUTOSEL 4.19 06/31] drm/amdgpu: avoid dereferencing a NULL pointer
Date: Mon, 10 Aug 2020 15:12:34 -0400 [thread overview]
Message-ID: <20200810191259.3794858-6-sashal@kernel.org> (raw)
In-Reply-To: <20200810191259.3794858-1-sashal@kernel.org>
From: Jack Xiao <Jack.Xiao@amd.com>
[ Upstream commit 55611b507fd6453d26030c0c0619fdf0c262766d ]
Check if irq_src is NULL to avoid dereferencing a NULL pointer,
for MES ring is uneccessary to recieve an interrupt notification.
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
index 869ff624b108c..e5e51e4d4f3d8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
@@ -396,7 +396,9 @@ int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring,
ring->fence_drv.gpu_addr = adev->uvd.inst[ring->me].gpu_addr + index;
}
amdgpu_fence_write(ring, atomic_read(&ring->fence_drv.last_seq));
- amdgpu_irq_get(adev, irq_src, irq_type);
+
+ if (irq_src)
+ amdgpu_irq_get(adev, irq_src, irq_type);
ring->fence_drv.irq_src = irq_src;
ring->fence_drv.irq_type = irq_type;
@@ -508,8 +510,9 @@ void amdgpu_fence_driver_fini(struct amdgpu_device *adev)
/* no need to trigger GPU reset as we are unloading */
amdgpu_fence_driver_force_completion(ring);
}
- amdgpu_irq_put(adev, ring->fence_drv.irq_src,
- ring->fence_drv.irq_type);
+ if (ring->fence_drv.irq_src)
+ amdgpu_irq_put(adev, ring->fence_drv.irq_src,
+ ring->fence_drv.irq_type);
drm_sched_fini(&ring->sched);
del_timer_sync(&ring->fence_drv.fallback_timer);
for (j = 0; j <= ring->fence_drv.num_fences_mask; ++j)
@@ -545,8 +548,9 @@ void amdgpu_fence_driver_suspend(struct amdgpu_device *adev)
}
/* disable the interrupt */
- amdgpu_irq_put(adev, ring->fence_drv.irq_src,
- ring->fence_drv.irq_type);
+ if (ring->fence_drv.irq_src)
+ amdgpu_irq_put(adev, ring->fence_drv.irq_src,
+ ring->fence_drv.irq_type);
}
}
@@ -572,8 +576,9 @@ void amdgpu_fence_driver_resume(struct amdgpu_device *adev)
continue;
/* enable the interrupt */
- amdgpu_irq_get(adev, ring->fence_drv.irq_src,
- ring->fence_drv.irq_type);
+ if (ring->fence_drv.irq_src)
+ amdgpu_irq_get(adev, ring->fence_drv.irq_src,
+ ring->fence_drv.irq_type);
}
}
--
2.25.1
next prev parent reply other threads:[~2020-08-10 19:22 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-10 19:12 [PATCH AUTOSEL 4.19 01/31] drm/tilcdc: fix leak & null ref in panel_connector_get_modes Sasha Levin
2020-08-10 19:12 ` [PATCH AUTOSEL 4.19 02/31] soc: qcom: rpmh-rsc: Set suppress_bind_attrs flag Sasha Levin
2020-08-10 19:12 ` [PATCH AUTOSEL 4.19 03/31] Bluetooth: add a mutex lock to avoid UAF in do_enale_set Sasha Levin
2020-08-10 19:12 ` [PATCH AUTOSEL 4.19 04/31] loop: be paranoid on exit and prevent new additions / removals Sasha Levin
2020-08-10 19:12 ` [PATCH AUTOSEL 4.19 05/31] fs/btrfs: Add cond_resched() for try_release_extent_mapping() stalls Sasha Levin
2020-08-10 19:12 ` Sasha Levin [this message]
2020-08-10 19:12 ` [PATCH AUTOSEL 4.19 07/31] drm/radeon: Fix reference count leaks caused by pm_runtime_get_sync Sasha Levin
2020-08-10 19:12 ` [PATCH AUTOSEL 4.19 08/31] crypto: aesni - Fix build with LLVM_IAS=1 Sasha Levin
2020-08-10 19:12 ` [PATCH AUTOSEL 4.19 09/31] video: fbdev: neofb: fix memory leak in neo_scan_monitor() Sasha Levin
2020-08-10 19:12 ` [PATCH AUTOSEL 4.19 10/31] md-cluster: fix wild pointer of unlock_all_bitmaps() Sasha Levin
2020-08-10 19:12 ` [PATCH AUTOSEL 4.19 11/31] arm64: dts: hisilicon: hikey: fixes to comply with adi, adv7533 DT binding Sasha Levin
2020-08-10 19:12 ` [PATCH AUTOSEL 4.19 12/31] drm/etnaviv: fix ref count leak via pm_runtime_get_sync Sasha Levin
2020-08-10 19:12 ` [PATCH AUTOSEL 4.19 13/31] drm/nouveau: fix multiple instances of reference count leaks Sasha Levin
2020-08-10 19:12 ` [PATCH AUTOSEL 4.19 14/31] usb: mtu3: clear dual mode of u3port when disable device Sasha Levin
2020-08-10 19:12 ` [PATCH AUTOSEL 4.19 15/31] drm/debugfs: fix plain echo to connector "force" attribute Sasha Levin
2020-08-10 19:12 ` [PATCH AUTOSEL 4.19 16/31] drm/radeon: disable AGP by default Sasha Levin
2020-08-10 19:12 ` [PATCH AUTOSEL 4.19 17/31] irqchip/irq-mtk-sysirq: Replace spinlock with raw_spinlock Sasha Levin
2020-08-10 19:12 ` [PATCH AUTOSEL 4.19 18/31] mm/mmap.c: Add cond_resched() for exit_mmap() CPU stalls Sasha Levin
2020-08-10 19:12 ` [PATCH AUTOSEL 4.19 19/31] brcmfmac: keep SDIO watchdog running when console_interval is non-zero Sasha Levin
2020-08-10 19:12 ` [PATCH AUTOSEL 4.19 20/31] brcmfmac: To fix Bss Info flag definition Bug Sasha Levin
2020-08-10 19:12 ` [PATCH AUTOSEL 4.19 21/31] brcmfmac: set state of hanger slot to FREE when flushing PSQ Sasha Levin
2020-08-10 19:12 ` [PATCH AUTOSEL 4.19 22/31] iwlegacy: Check the return value of pcie_capability_read_*() Sasha Levin
2020-08-10 19:12 ` [PATCH AUTOSEL 4.19 23/31] gpu: host1x: debug: Fix multiple channels emitting messages simultaneously Sasha Levin
2020-08-10 19:12 ` [PATCH AUTOSEL 4.19 24/31] usb: gadget: net2280: fix memory leak on probe error handling paths Sasha Levin
2020-08-10 19:12 ` [PATCH AUTOSEL 4.19 25/31] bdc: Fix bug causing crash after multiple disconnects Sasha Levin
2020-08-10 19:12 ` [PATCH AUTOSEL 4.19 26/31] usb: bdc: Halt controller on suspend Sasha Levin
2020-08-10 19:12 ` [PATCH AUTOSEL 4.19 27/31] dyndbg: fix a BUG_ON in ddebug_describe_flags Sasha Levin
2020-08-10 19:12 ` [PATCH AUTOSEL 4.19 28/31] dyndbg: prefer declarative init in caller, to memset in callee Sasha Levin
2020-08-10 19:12 ` [PATCH AUTOSEL 4.19 29/31] bcache: fix super block seq numbers comparision in register_cache_set() Sasha Levin
2020-08-10 19:12 ` [PATCH AUTOSEL 4.19 30/31] ACPICA: Do not increment operation_region reference counts for field units Sasha Levin
2020-08-10 19:12 ` [PATCH AUTOSEL 4.19 31/31] drm/msm: ratelimit crtc event overflow error Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200810191259.3794858-6-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=Hawking.Zhang@amd.com \
--cc=Jack.Xiao@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®