From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 14DF65867C5; Wed, 9 Sep 2026 14:32:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788964340; cv=none; b=mMaAk7ot3F9E1mVibE3k7uWrq9FE53AgkibEhKXZo06+oKkNe5ZfHWJe4vBGJo24WU0oyARx976E0fhLzp1+gE2Lzay9CfsbAW/Y57WpcPQ5QmB7y9XED5sV+gCV7ZuzYqb9Hv/0y6+zWkhjD+jfMyt6MLkW7OL5KakS73TYjvQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788964340; c=relaxed/simple; bh=NduQJV4QmF+Pe81cn3MreE5MEFBB03yP3ZZ+sc8mAbw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bO2A9i+f1b6sSRy23/dZcd3GEdGKD57at5LzZjeRE489OdKlDnn/5BwC/gbQS4VQqMOG9EjltFBagYY+FfToZAEBfh2egDIJ9vMs3vTx+XpPWZwfp578yto4BpKLmVcvLnC+zeb3cUUOmG/EODp6MzP4FzvoW1iqwdpxEnkUgMI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=BtzAs61z; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="BtzAs61z" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 120461F00A3A; Wed, 9 Sep 2026 14:32:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788964338; bh=vklVij6XjlJ3ZeZTHndVk0ZEZB4NdFnb/lMK9DVLc/A=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=BtzAs61zbdhcFNzio4nVBbXnbR1I0lrjhAhI99JnHwwT6dFWf/pbFGf4DBJf0J83J hG2zq8WVjl3b5hS4hmGHbCqZqPjjsWFHRd2uY97WlAooKgAtDCGcjdaLpr4mDaxQ05 4OsHGUOrtNGyW0/saBGF7mJlxbg0N0UlCIcP05Eo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+9ae8e7884e451eaed5b4@syzkaller.appspotmail.com, Tao Yu , Ruben Wauters Subject: [PATCH 6.18 388/583] drm/gud: validate TV mode names before creating enum property Date: Wed, 9 Sep 2026 15:41:13 +0200 Message-ID: <20260909134251.429628459@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260909134237.773280130@linuxfoundation.org> References: <20260909134237.773280130@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tao Yu commit da1ea35fea67ad841f4ada28dd61b41be65e5437 upstream. The GUD protocol returns TV mode names as fixed-size GUD_CONNECTOR_TV_MODE_NAME_LEN entries and requires each name to be NUL-terminated. gud_connector_add_tv_mode() currently passes each fixed-size entry directly to drm_mode_create_tv_properties_legacy(), which eventually reaches drm_property_add_enum() and strlen(). If a device returns an entry without a terminating NUL byte, strlen() reads past the end of the slot and can run beyond the allocated buffer, triggering an out-of-bounds read. Validate that each returned TV mode name contains a NUL terminator within its fixed-size slot before passing it to the DRM property code. If a malformed entry is found, reject the device response with -EIO. This fixes the out-of-bounds read without changing the handling of valid devices, and avoids silently truncating malformed protocol data. Reported-by: syzbot+9ae8e7884e451eaed5b4@syzkaller.appspotmail.com Fixes: 40e1a70b4aed ("drm: Add GUD USB Display driver") Signed-off-by: Tao Yu Reviewed-by: Ruben Wauters Cc: Signed-off-by: Ruben Wauters Link: https://patch.msgid.link/20260819072835.4074130-1-tao1.yu@intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/gud/gud_connector.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/gud/gud_connector.c +++ b/drivers/gpu/drm/gud/gud_connector.c @@ -399,8 +399,11 @@ static int gud_connector_add_tv_mode(str for (i = 0; i < num_modes; i++) { char *mode = &buf[i * GUD_CONNECTOR_TV_MODE_NAME_LEN]; - /* The device is not trusted to NUL-terminate the name */ - mode[GUD_CONNECTOR_TV_MODE_NAME_LEN - 1] = '\0'; + if (!memchr(mode, '\0', GUD_CONNECTOR_TV_MODE_NAME_LEN)) { + ret = -EIO; + goto free; + } + modes[i] = mode; }