From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oa1-f69.google.com (mail-oa1-f69.google.com [209.85.160.69]) (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 4545D347500 for ; Sun, 16 Aug 2026 08:23:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.69 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786868606; cv=none; b=W09lKwmheIZOhxownONHZhdI5sKla3MZv25dt5H383UaZx7KlOn2uWu96WX6EbI9UK+/08Wv8NmeJtcuaOP61Js01iLdovNJ5yMMLvI+ouV5oFVCLhOUN1BNXgItf1Xt6s+CwtV0WbPmvD3DqY+5FCW7AZOrDxp8ox8HW+WFlTU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786868606; c=relaxed/simple; bh=JkHmUnHazrfgifQv3dT4jdrI9dDfONMoOrtYTNm3vUU=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=WgilKtysiis+Tzsw1vWt8UslSVyYTULknccw/a7pO4DTPmQN0N+hDtSPE+Obeh7+HVsMBbVtSwF/MpPL6G7I0JlKV0YStWxROhhBQFS/4c6Av072UhNTGnNtqgJVnxyCxtn+JCvW+CKgoab/zTRdi0GPu+kalBywMCP1aji42Ew= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.160.69 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-oa1-f69.google.com with SMTP id 586e51a60fabf-4412c255fd4so2678272fac.3 for ; Sun, 16 Aug 2026 01:23:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786868604; x=1787473404; h=content-type:to:from:subject:message-id:in-reply-to:date :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=Ag4gN6mGcMNqH6Lia8rKdG3HxwRJxBaLNP/rn2Dsm+k=; b=EMYPq0MBaDpXeyGZUgWtnbLzDZvfwYCCYEow45jhodKTdPBZEPvWym8O0QKhTQa6rK /QnV1eICuyX+f3RLltE8AnOYQihoKZPZiO/5Zh32OhL13CieB/NiZJVwQgrwxQKDV2Au I5TNrwnaPyhQg1a02kfN4paMeu42aI/VdJ0WpSLWMwZKA9Ubb8RwBopuRBJQFLL92UOL WQsqtSD42OXO7FXjsuoO9bORhMGDMnaYWnWpPuPENzdQA3ERh0pwuLCNYj5wlwfeiNMR kNdfghfez6af5f2GQayLYUdHkJSyLC7QmMkuNqo/CApoNaonW6ARv+Y/Gn6hIrRPoiuo p67A== X-Gm-Message-State: AOJu0YwxYehj5MVbSZDvjHQT0KBYxAkc3k9NZTpenZj7RIgau91WrQkd kW6W+e2zccJCP3YGOD+kmB++IYHuwoxws9uf/ZMZtXd4DQ3fiB3EZPppu+w5iIS3aCOAy4ydnGw ryfX1TvY7Za5I3oc23B5SvOcn5a4MCUK6UEtpr3g1/ebaYev8vxd5jNt/664= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a05:6820:1c90:b0:6a0:a791:6885 with SMTP id 006d021491bc7-6b0d68d2df0mr14889629eaf.23.1786868604141; Sun, 16 Aug 2026 01:23:24 -0700 (PDT) Date: Sun, 16 Aug 2026 01:23:24 -0700 In-Reply-To: <6a81590a.dbb3a75c.20434b.002a.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <6a81737c.f7a79266.2f965f.0012.GAE@google.com> Subject: Forwarded: [PATCH] drm/gud: NUL-terminate TV mode names read from the device From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Type: text/plain; charset="UTF-8" For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com. *** Subject: [PATCH] drm/gud: NUL-terminate TV mode names read from the device Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master gud_connector_add_tv_mode() reads a buffer of fixed-size mode names from the USB device and passes pointers into it to drm_mode_create_tv_properties_legacy(), which calls strlen() on each one. Nothing guarantees the device NUL-terminates a name, so strlen() can run past the end of a slot and, for the last mode, past the end of the allocation. Terminate each name at the end of its slot before use. Reported-by: syzbot+916c888ba5f1a54c9526@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=916c888ba5f1a54c9526 Signed-off-by: Deepanshu Kartikey --- drivers/gpu/drm/gud/gud_connector.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/gud/gud_connector.c b/drivers/gpu/drm/gud/gud_connector.c index ea0cca58b7c8..5c0065c876a7 100644 --- a/drivers/gpu/drm/gud/gud_connector.c +++ b/drivers/gpu/drm/gud/gud_connector.c @@ -396,8 +396,13 @@ static int gud_connector_add_tv_mode(struct gud_device *gdrm, struct drm_connect } num_modes = ret / GUD_CONNECTOR_TV_MODE_NAME_LEN; - for (i = 0; i < num_modes; i++) - modes[i] = &buf[i * GUD_CONNECTOR_TV_MODE_NAME_LEN]; + 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'; + modes[i] = mode; + } ret = drm_mode_create_tv_properties_legacy(connector->dev, num_modes, modes); free: -- 2.43.0