From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D0134318B9B for ; Sat, 22 Aug 2026 14:58:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787410684; cv=none; b=pqgJduUrPB86NBNvgS3XHVtuNxYPMXI3gr5VUB8yxiAxJE2Ac36VUVjZ0yst6/goSH+pIEqsMu4wDdqCN17mjgcyZFYDE8ebtIILpP2HYx3PLUWcSsUQ1JHJLeMHWX1sCo904Q01RjUY1aFWO9smbWrEYS1rJVruJ7mAOClDtuo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787410684; c=relaxed/simple; bh=AdJsdcgZUFpUiNPvVAEKrPEhD/NfnHzpuS2LF2Z33Ec=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=KtFTAbNh/tdPCInx4fcffyBBZymod2TxS/qrKrahIhZ2ue86GepNhak0+Tr8q7caq4jgfRxJ7mspgtRpcsgbSAOzYnvQ+6HF4pdlir1pzK/fsWQBYXPy+16M4FL9jIPubCOWt4basU8+rq3c/feA2dYgddynNA0g7Yvv5Ii3M+g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=rKIPMvAs; arc=none smtp.client-ip=209.85.208.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rKIPMvAs" Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-6a17211b9ecso5419314a12.2 for ; Sat, 22 Aug 2026 07:58:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787410681; x=1788015481; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=MxLxyi+V+p9av77WPt9hWKy9ZGIfmbgiIMqaVzXmUOQ=; b=rKIPMvAs7S1xB96zjKy+m026uxGS3TDdj1L90GlPWcaib+i8nfjtXA05oa+Gco7Hfe jt8u6h5JrvcYFfn94HyPwnG3XJ9oaFT1hMdOYSQ1y8el6jTOZcnGuotVshRyYMihGBlp vH+FPWg6gNpMQGSw3r2zzXwynamaemfEbb3NaEQApoEFg7IkiMApk2CriOFTjZhC7D37 lP4duDXeqjbbYMELKL00lAa1Akabzpchds/RXA2h34Y9ESApodKgKM0XaAM3K20qwd7B ZT04V3e1aSd68BQt3lzcwPULTjlx3uOq7Ur5o5BV9PMmXFP70BRHujhDUcJZoEzx3JNv oZ7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787410681; x=1788015481; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=MxLxyi+V+p9av77WPt9hWKy9ZGIfmbgiIMqaVzXmUOQ=; b=eTiwJlJXWrF/o6lRsATkcDpq/KoOGdS3g6A7b7N5D8Saw9bm/pg4RVVGzqRRQUk3wb qKVVGnBwtgw9zJX86I1qPXEIs74fq8vxmMdyeXaGPKQdivmmtIdtX+2PlwY2YmP2qAjR 3UiMCokl9blDP3CsxbERNiVzyulu514DlmbJ3fZHWUFRjgQUAs8DtPb9Ere1QZaKneKq ZtFwihkqAyVwQgLP7GPR0I/HiMRU520XE41xUWM0xdZ7bSQ5cs1G2Xw/fuR7xPfx0o7a Vsa2i037JVdliyZZL6Cxt3BVuwiqayw0OPG+i9NYdB6bp6tlpW6QZgkf/MeWfBgA8rOH AyXg== X-Forwarded-Encrypted: i=1; AHgh+RoYWL0FNPuVHl4ZAAelL0mkZtxO3Sl03O02IiLq5LBc0Ug8MC2w16pbFaZ1KD3u3b3SG3IGXKz8ck27Oz0=@vger.kernel.org X-Gm-Message-State: AFuF++kDAtujxzcoBjlGILrCOPFnPkJzbryHirbqfd9Am/iXTUxYSl/3 savrmC1yRBiqsBzakWIaeNSlvA52jSQp7CLZ7ZZFhbS09nNcGywEt9Ev X-Gm-Gg: AR+sD11x51Z31PHe8emaYsfDVwnBKcri7WxWyvq2doSdtk8aCCVQhdj261IERuz/dST anRpar79NIltZ/0uxfjgcspE3LXB534WIJ+XmIljvAv42TXjovqcGP0WU5MyumB7lODIRtetShH 10KchVa/h2HjopsAIHqpRtHenNWUPUYmnrYqAxr7C+oJ6L7XTNjWKOkrvV+MD2cxHPwbbSUS3+O 3bWYiTw/i865FzAEmWVd3x99y3WWdQpCByNTi1GRzQTzZp1clQKpYeDS/xL9MqgNtjoglmfEHks p2XxtW9vdWsED6h8IVrRi5js0qGShJnqcd72oeNvLf2NvVCYApKEM67sToC/3yXyEjLbyKOxUvn 6pKArCN+Ubf9lkcZoCzlZLUt7VUtWJoCIGUsByRnZFRWAb2ONV4aj2+XZ5X8o8mGmyiBDE5bO0j q2FAFLiDdyJNOJhrxsUQEI1yfoi1rNMIsaQbtI7OwzPcRN4UuQRB9PLc4fma7l5Hfg00nVzkX4H 9Cz2liazQC/BfT34m5YLhlmmheHvD9+ugd6moFoluPPd5yCubmNjx6nBBaD57eIMad/wg== X-Received: by 2002:a05:6402:a0d8:b0:6a0:926e:f907 with SMTP id 4fb4d7f45d1cf-6a42f184b7dmr17373988a12.1.1787410680740; Sat, 22 Aug 2026 07:58:00 -0700 (PDT) Received: from localhost.localdomain (2a02-a463-a071-0-e100-b32a-30a-b4b.fixed6.kpn.net. [2a02:a463:a071:0:e100:b32a:30a:b4b]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6a3ff17df84sm16471538a12.31.2026.08.22.07.57.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Aug 2026 07:58:00 -0700 (PDT) From: Hari Mishal To: Harry Wentland Cc: Leo Li , Rodrigo Siqueira , Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , David Airlie , Simona Vetter , Dillon Varone , Gaghik Khachatrian , Cruise Hung , Chenyu Chen , Peichen Huang , Qingqing Zhuo , Jun Lei , Mustapha Ghaddar , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Hari Mishal Subject: [PATCH] drm/amd/display: fix division by zero in get_estimated_bw() Date: Sat, 22 Aug 2026 16:57:51 +0200 Message-ID: <20260822145751.42328-1-harimishal1@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: 8e5cfe547bf3 ("drm/amd/display: upstream link_dp_dpia_bw.c") Assisted-by: gkh_clanker_t1000 Signed-off-by: Hari Mishal --- .../gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c index dd854d992692..f43fc4b78a8d 100644 --- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c +++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c @@ -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, -- 2.43.0