From nobody Sat Feb 7 17:55:20 2026 Received: from mail-oa1-f70.google.com (mail-oa1-f70.google.com [209.85.160.70]) (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 1A6C029CE9 for ; Mon, 26 Jan 2026 05:48:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.70 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769406525; cv=none; b=svaBJa7ncDTRCxRZHJef6VdaaFBHZSmr2kuHrgW1z4kyGHGYs3LGHlZNJAFQDdhVitE8xlNjeEaOZYEZvmg76HrWCzvoQ2JO/ojiFmIfq3I7qzZE3GOorGsL67sKUUri5FkXV9bF89Ho06TX2OeMtaSHNqAVlNMNpNuqKaidFaw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769406525; c=relaxed/simple; bh=K3JUA+sr/0m4nws5jg66A+tO+531eknAhg80MPDlcGo=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=cqsXU6rbA7PI8UdnEfCdM96n5jMYtLIbrF+LE2c6WrYCvKOZ4C7j3qDxRo7FQ5L/JWtMalxua8BaT+GA6+Nc9XGtvSyI2fX3kzran5ObcrHVXCHRfCYon5E8hznjPzohONzUwoKBZDDuNlTD+05iawNfy1TlvMB+dWt94NbwhsQ= 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.70 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-f70.google.com with SMTP id 586e51a60fabf-404563556e9so6644597fac.3 for ; Sun, 25 Jan 2026 21:48:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769406523; x=1770011323; h=to:from:subject:message-id:in-reply-to:date:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MALus5Cs7PTe3Eq5fgwo3LLTiN4Eest0aCpLRaVCQFs=; b=mlutazvmdVVelCnzZPaeDagb01bwDrXwxSNvyLEE5GqdQHQ7NULeEBhIsiZwxOBARS 53M3a3GjYovLtY16o2xD2FvbqgJg+9RY80FHNj2h7WYyej4Sww8BA1SPgnDWaLZwfS1f PYzUpIqj923rku3TMPAHVD8Hhj3Ci8NK2qR5IVxMcvJOE7ZNJeahDvQetxmr02AYtxrU IWvLyh27WB8hxjBXZ8jCpTvkUt7fz2UfCt0/bKZ7SjQX3kPbt6eF57B9Ef51DIi+YnES AVAZS5xQRbT0yh3ilie8KxOA5tao2w5UUjBKVhRizY1DOCYaN4iA9MGqvjn/MN7SqWgy ZToA== X-Gm-Message-State: AOJu0YygzczNhHIe3GsmFp+Ru9ohqNpB0cQPoStn+B1duLuBYUi876xM KGVNVIJlvYTW2GgVJHT+mCKqazIuXOH/0ScS6J3oOCHatkvoAaoSE0bIClnqlKdNIso66VzBihS t4Wn/R1tn7vL/++Pg7e9i6Y5uxHCGJjYG2vIJVDUenSZ8YDhnKgfuIC191nE= 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:1609:b0:659:9a49:8e0d with SMTP id 006d021491bc7-662e0498f2amr1927391eaf.79.1769406523082; Sun, 25 Jan 2026 21:48:43 -0800 (PST) Date: Sun, 25 Jan 2026 21:48:43 -0800 In-Reply-To: <69746a86.050a0220.226181.0003.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <6977003b.a00a0220.33ccc7.0032.GAE@google.com> Subject: Forwarded: [PATCH] comedi: dt2815: add hardware detection to prevent crash on invalid I/O ports From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Transfer-Encoding: quoted-printable 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] comedi: dt2815: add hardware detection to prevent crash on= invalid I/O ports Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git= master The dt2815 driver crashes when attached to I/O ports without actual hardware present. This occurs because syzkaller or users can attach the driver to arbitrary I/O addresses via COMEDI_DEVCONFIG ioctl. When no hardware exists at the specified port, inb() operations return 0xff (floating bus). The driver misinterprets this as a valid status and attempts error recovery via outb(), which triggers undefined behavior on the second iteration, ultimately causing a page fault: BUG: unable to handle page fault for address: 000000007fffff90 #PF: supervisor write access in kernel mode #PF: error_code(0x0002) - not-present page RIP: 0010:dt2815_attach+0x6a8/0x9e0 Add an early hardware detection check: if the first status read returns 0xff, assume no hardware is present and fail the attach with -ENODEV. This prevents the crash and provides a clear error message to users. Reported-by: syzbot+72f94b474d6e50b71ffc@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3D72f94b474d6e50b71ffc Signed-off-by: Deepanshu Kartikey --- drivers/comedi/drivers/dt2815.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/comedi/drivers/dt2815.c b/drivers/comedi/drivers/dt281= 5.c index 03ba2fd18a21..1578cebae8e7 100644 --- a/drivers/comedi/drivers/dt2815.c +++ b/drivers/comedi/drivers/dt2815.c @@ -183,6 +183,15 @@ static int dt2815_attach(struct comedi_device *dev, st= ruct comedi_devconfig *it) =20 usleep_range(1000, 3000); status =3D inb(dev->iobase + DT2815_STATUS); + + /* 0xff usually indicates no hardware present on the bus */ + if (i =3D=3D 0 && status =3D=3D 0xff) { + dev_err(dev->class_dev, + "No hardware detected at I/O base 0x%lx\n", + dev->iobase); + return -ENODEV; + } + if (status =3D=3D 4) { unsigned int program; =20 --=20 2.43.0