From nobody Fri Dec 19 11:49:54 2025 Received: from mail-ot1-f69.google.com (mail-ot1-f69.google.com [209.85.210.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 41277221DB9 for ; Mon, 8 Dec 2025 02:25:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.69 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765160737; cv=none; b=Y6ytqeyfufP08Z9iqqtT1pgMdCKYW1UgE5FkUd80H/z6LQrUB2BZWBY5h2S6BOyqZYAtFdTkXkibPsTBhNO9lmxFkC7GikOT4pCieheH6Tt3m1b3lrrRvkYyXmhg5R5gGTqzGVPjr7YedoNylkH5F5QMRDDNbPSiuJ+3xi/Xe7w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765160737; c=relaxed/simple; bh=NKkIS+asYwJ76aAAM23ZPw2tlpwIaq28C/CIT10rnOo=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=soK5azz2vAXg33Dplii9e61ZBh0Dy0QtjVrRYQumVDcl8yrjCmJad9EXwkMGtlLiv19w8tWGRIsAg7l4jSf4lKr18fIB+5ftEZU/kpi3XY5tYfEfkXo3O0EaAAa46FPpeVK54sngKopY4NCikc7CgLIUjOx2S/hjvYAmHjtzah0= 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.210.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-ot1-f69.google.com with SMTP id 46e09a7af769-7c7562d889cso8502026a34.1 for ; Sun, 07 Dec 2025 18:25:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765160733; x=1765765533; h=content-transfer-encoding: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=UL7s0PSAfyfVPnVXISyLv9Swch8RvV1QFjqycJPEiJk=; b=CL/SGAL5OlQe4ImMfkgvxN7boTrELoJhnFUdcvqZ3wjSly5quw0ZIYF3XB9vgCIULP HJs50SYEEzJbVlCeIkxPw7eNaKlBg8rZhI8/CCTOxXndw4j1HXzve8qNJOb2u4+8lUHY NK8HTLaliuAb4p3D4ika/RjIW0nmryari03YGvc8wTSmGJzPFb95f7TVqZUxBZlD201M r1a+bqWELHdyalYEBDhaFRoU5ej2TmYathdlZah77ZyoP6SLPT2FrOCDwyWeqGELOTqt BzRcfVGL/XroE2z7T1JIQFFTpmub8VrKlM9IECE7E+Kb7ZMAmkCkxuwCI0ZyDktMd7kL pmCA== X-Gm-Message-State: AOJu0Yy1QED8XwWvJNpBdkuT1RjcPPltKkilY2lX4MgP4bvp7wJ/kkpE 2Hr0KoliuhAKitHe7cxo8jJouIVa7F0Vnu4PG63rXCoxM0MWV1H1lmCQWTTFpgtNIl7nNF/JsZ6 iVaLIoVoDruVXsJXhzT0+1uAmO2dPVVGUSmykL4vaCbBdwZW/SLjwci/U8NM= X-Google-Smtp-Source: AGHT+IEykVLVNdL/wh7KCyJ2L+4mhU7Z1MgDaT8SQZvxm28KU0uuQv7Mjjqhj6iK/9isKPYvG6aih8jn0QxUaJ+D7Zd5ewV5L2qU 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:861c:b0:659:9a49:8e32 with SMTP id 006d021491bc7-6599a499e1emr2334563eaf.36.1765160733017; Sun, 07 Dec 2025 18:25:33 -0800 (PST) Date: Sun, 07 Dec 2025 18:25:33 -0800 In-Reply-To: <68a7b69f.050a0220.37038e.0047.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <6936371d.a70a0220.38f243.0074.GAE@google.com> Subject: Forwarded: [PATCH] media: dw2102: validate I2C messages in su3000_i2c_transfer() 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] media: dw2102: validate I2C messages in su3000_i2c_transfe= r() Author: dharanitharan725@gmail.com #syz test syzbot reports a general protection fault caused by su3000_i2c_transfer() dereferencing msg->buf without validating the message length or buffer pointer. Although i2c-dev blocks zero-length messages, malformed I=C2=B2C messages can still reach the driver through the DVB USB subsystem. Add strict validation of each message to prevent NULL-pointer dereferences. Reported-by: syzbot+d99f3a288cc7d8ef60fb@syzkaller.appspotmail.com Fixes: 0e148a522b84 ("media: dw2102: Don't translate i2c read into write") Signed-off-by: Dharanitharan R --- drivers/media/usb/dvb-usb/dw2102.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb= /dw2102.c index 4fecf2f965e9..0dd210ea16f3 100644 --- a/drivers/media/usb/dvb-usb/dw2102.c +++ b/drivers/media/usb/dvb-usb/dw2102.c @@ -733,6 +733,36 @@ static int su3000_i2c_transfer(struct i2c_adapter *ada= p, struct i2c_msg msg[], return -EAGAIN; } =20 + /* Validate incoming I=C2=B2C messages */ + if (!msg || num <=3D 0) { + mutex_unlock(&d->data_mutex); + mutex_unlock(&d->i2c_mutex); + return -EINVAL; + } + + for (j =3D 0; j < num; j++) { + /* msg buffer must exist */ + if (!msg[j].buf) { + mutex_unlock(&d->data_mutex); + mutex_unlock(&d->i2c_mutex); + return -EINVAL; + } + + /* zero or negative length is invalid */ + if (msg[j].len <=3D 0) { + mutex_unlock(&d->data_mutex); + mutex_unlock(&d->i2c_mutex); + return -EINVAL; + } + + /* protect against unreasonable sizes */ + if (msg[j].len > 256) { + mutex_unlock(&d->data_mutex); + mutex_unlock(&d->i2c_mutex); + return -EOPNOTSUPP; + } + } + j =3D 0; while (j < num) { switch (msg[j].addr) { --=20 2.43.0