mirror of
https://github.com/torvalds/linux.git
synced 2026-09-12 04:23:03 +02:00
drm/amd/display: fix division by zero in get_estimated_bw()
get_estimated_bw() divides by link->dpia_bw_alloc_config.bw_granularity,
which is zeroed by reset_bw_alloc_struct() and only populated once
DP_TUNNELING_BW_ALLOC_CAP_CHANGED has been handled.
link_dp_dpia_handle_bw_alloc_status(), the DPCD interrupt handler,
calls get_estimated_bw() whenever DP_TUNNELING_ESTIMATED_BW_CHANGED
is set, independently of whether DP_TUNNELING_BW_ALLOC_CAP_CHANGED
has ever fired for that link. A connected USB4/DPIA tunneling device
that reports an estimated-bandwidth change before ever reporting a
capability change drives a division by zero in this IRQ path.
link_dpia_send_bw_alloc_request() already guards the same
bw_granularity division; add the identical guard here rather than
introducing a new pattern.
Fixes: 8e5cfe547b ("drm/amd/display: upstream link_dp_dpia_bw.c")
Reviewed-by: Alex Hung <alex.hung@amd.com>
Assisted-by: gkh_clanker_t1000
Signed-off-by: Hari Mishal <harimishal1@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit f2a961457c33dc34223aad5c9e8971de34a4eed3)
Cc: stable@vger.kernel.org
This commit is contained in:
parent
4278d65a41
commit
f63de9054d
|
|
@ -103,6 +103,11 @@ static int get_estimated_bw(struct dc_link *link)
|
|||
{
|
||||
uint8_t bw_estimated_bw = 0;
|
||||
|
||||
if (link->dpia_bw_alloc_config.bw_granularity == 0) {
|
||||
DC_LOG_ERROR("%s: BW granularity is zero!\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
core_link_read_dpcd(
|
||||
link,
|
||||
ESTIMATED_BW,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user