[syzbot] [media?] general protection fault in su3000_i2c_transfer

17 views
Skip to first unread message

syzbot

unread,
Aug 21, 2025, 8:15:30 PM8/21/25
to linux-...@vger.kernel.org, linux...@vger.kernel.org, mch...@kernel.org, mi...@freedict.org, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 8d561baae505 Merge tag 'x86_urgent_for_v6.17_rc2' of git:/..
git tree: upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=15226ba2580000
kernel config: https://syzkaller.appspot.com/x/.config?x=ce98061fb8ee27bc
dashboard link: https://syzkaller.appspot.com/bug?extid=d99f3a288cc7d8ef60fb
compiler: Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=176206f0580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=102993a2580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/f70b0639e5f7/disk-8d561baa.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/8d12dcdbfe95/vmlinux-8d561baa.xz
kernel image: https://storage.googleapis.com/syzbot-assets/47f7ceb7ac19/bzImage-8d561baa.xz

The issue was bisected to:

commit 0e148a522b8453115038193e19ec7bea71403e4a
Author: Michael Bunk <mi...@freedict.org>
Date: Sun Jan 16 11:22:36 2022 +0000

media: dw2102: Don't translate i2c read into write

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=14657ba2580000
final oops: https://syzkaller.appspot.com/x/report.txt?x=16657ba2580000
console output: https://syzkaller.appspot.com/x/log.txt?x=12657ba2580000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+d99f3a...@syzkaller.appspotmail.com
Fixes: 0e148a522b84 ("media: dw2102: Don't translate i2c read into write")

Oops: general protection fault, probably for non-canonical address 0xdffffc0000000002: 0000 [#1] SMP KASAN PTI
KASAN: null-ptr-deref in range [0x0000000000000010-0x0000000000000017]
CPU: 1 UID: 0 PID: 5865 Comm: syz-executor259 Not tainted 6.17.0-rc1-syzkaller-00224-g8d561baae505 #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
RIP: 0010:su3000_i2c_transfer+0x1ad/0x1040 drivers/media/usb/dvb-usb/dw2102.c:740
Code: 4c 89 f8 48 c1 e8 03 49 bc 00 00 00 00 00 fc ff df 42 80 3c 20 00 74 08 4c 89 ff e8 8d b6 3c fa 49 8b 1f 48 89 d8 48 c1 e8 03 <42> 0f b6 04 20 84 c0 0f 85 5f 09 00 00 0f b6 1b 48 8b 44 24 38 42
RSP: 0018:ffffc9000411faa8 EFLAGS: 00010202

RAX: 0000000000000002 RBX: 0000000000000010 RCX: 0000000000000003
RDX: ffffffff87e65d05 RSI: ffffffff8f0d3a50 RDI: 0000000000001900
RBP: 0000000000000000 R08: ffff888032dd0000 R09: 0000000000000002
R10: 0000000000001a00 R11: 0000000000000000 R12: dffffc0000000000
R13: 1ffff1100fb25968 R14: 0000000000000002 R15: ffff88807d92cb48
FS: 000055556ae14380(0000) GS:ffff888125d1b000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055b6f1430230 CR3: 000000007277a000 CR4: 00000000003526f0
Call Trace:
<TASK>
__i2c_transfer+0x871/0x2170 drivers/i2c/i2c-core-base.c:-1
i2c_transfer+0x25b/0x3a0 drivers/i2c/i2c-core-base.c:2320
i2cdev_ioctl_rdwr+0x460/0x740 drivers/i2c/i2c-dev.c:306
i2cdev_ioctl+0x64b/0x7f0 drivers/i2c/i2c-dev.c:467
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:598 [inline]
__se_sys_ioctl+0xf9/0x170 fs/ioctl.c:584
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fc919191e19
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 31 17 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffcc5ebd038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007fc9191cd533 RCX: 00007fc919191e19
RDX: 0000200000000a40 RSI: 0000000000000707 RDI: 0000000000000004
RBP: 00007fc919205610 R08: 0000000000002a00 R09: 00007ffcc5ebd208
R10: 0000000000000001 R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffcc5ebd1f8 R14: 0000000000000001 R15: 0000000000000001
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:su3000_i2c_transfer+0x1ad/0x1040 drivers/media/usb/dvb-usb/dw2102.c:740
Code: 4c 89 f8 48 c1 e8 03 49 bc 00 00 00 00 00 fc ff df 42 80 3c 20 00 74 08 4c 89 ff e8 8d b6 3c fa 49 8b 1f 48 89 d8 48 c1 e8 03 <42> 0f b6 04 20 84 c0 0f 85 5f 09 00 00 0f b6 1b 48 8b 44 24 38 42
RSP: 0018:ffffc9000411faa8 EFLAGS: 00010202
RAX: 0000000000000002 RBX: 0000000000000010 RCX: 0000000000000003
RDX: ffffffff87e65d05 RSI: ffffffff8f0d3a50 RDI: 0000000000001900
RBP: 0000000000000000 R08: ffff888032dd0000 R09: 0000000000000002
R10: 0000000000001a00 R11: 0000000000000000 R12: dffffc0000000000
R13: 1ffff1100fb25968 R14: 0000000000000002 R15: ffff88807d92cb48
FS: 000055556ae14380(0000) GS:ffff888125c1b000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000562d24ac2168 CR3: 000000007277a000 CR4: 00000000003526f0
----------------
Code disassembly (best guess):
0: 4c 89 f8 mov %r15,%rax
3: 48 c1 e8 03 shr $0x3,%rax
7: 49 bc 00 00 00 00 00 movabs $0xdffffc0000000000,%r12
e: fc ff df
11: 42 80 3c 20 00 cmpb $0x0,(%rax,%r12,1)
16: 74 08 je 0x20
18: 4c 89 ff mov %r15,%rdi
1b: e8 8d b6 3c fa call 0xfa3cb6ad
20: 49 8b 1f mov (%r15),%rbx
23: 48 89 d8 mov %rbx,%rax
26: 48 c1 e8 03 shr $0x3,%rax
* 2a: 42 0f b6 04 20 movzbl (%rax,%r12,1),%eax <-- trapping instruction
2f: 84 c0 test %al,%al
31: 0f 85 5f 09 00 00 jne 0x996
37: 0f b6 1b movzbl (%rbx),%ebx
3a: 48 8b 44 24 38 mov 0x38(%rsp),%rax
3f: 42 rex.X


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
For information about bisection process see: https://goo.gl/tpsmEJ#bisection

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

Lizhi Xu

unread,
Aug 21, 2025, 9:41:38 PM8/21/25
to syzbot+d99f3a...@syzkaller.appspotmail.com, syzkall...@googlegroups.com
#syz test

diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
index e9577f920286..17b0bec53e21 100644
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -257,7 +257,7 @@ static noinline int i2cdev_ioctl_rdwr(struct i2c_client *client,
res = 0;
for (i = 0; i < nmsgs; i++) {
/* Limit the size of the message to a sane amount */
- if (msgs[i].len > 8192) {
+ if (msgs[i].len > 8192 || msgs[i].len == 0) {
res = -EINVAL;
break;
}

syzbot

unread,
Aug 21, 2025, 10:09:05 PM8/21/25
to linux-...@vger.kernel.org, lizh...@windriver.com, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-by: syzbot+d99f3a...@syzkaller.appspotmail.com
Tested-by: syzbot+d99f3a...@syzkaller.appspotmail.com

Tested on:

commit: 3957a572 Merge tag 'cgroup-for-6.17-rc2-fixes' of git:..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=10a6fbbc580000
kernel config: https://syzkaller.appspot.com/x/.config?x=292f3bc9f654adeb
dashboard link: https://syzkaller.appspot.com/bug?extid=d99f3a288cc7d8ef60fb
compiler: Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7
patch: https://syzkaller.appspot.com/x/patch.diff?x=1206f442580000

Note: testing is done by a robot and is best-effort only.

Lizhi Xu

unread,
Aug 21, 2025, 10:10:08 PM8/21/25
to syzbot+d99f3a...@syzkaller.appspotmail.com, linux-...@vger.kernel.org, linux...@vger.kernel.org, mch...@kernel.org, mi...@freedict.org, syzkall...@googlegroups.com
The user passed two messages via ioctl, both of which were zero-length.
This caused i2cdev_ioctl_rdwr() to allocate zero-length memory for msgs[i].buf
when executing memdup_user(), resulting in a ZERO_SIZE_PTR.
i2cdev_ioctl_rdwr() did not handle this situation, leading to a null-ptr-deref
when accessing msgs[i].buf in su3000_i2c_transfer().

Adding a zero-length check in i2cdev_ioctl_rdwr() resolves the ZERO_SIZE_PTR
issue.

Reported-by: syzbot+d99f3a...@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=d99f3a288cc7d8ef60fb
Tested-by: syzbot+d99f3a...@syzkaller.appspotmail.com
Signed-off-by: Lizhi Xu <lizh...@windriver.com>
---
drivers/i2c/i2c-dev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--
2.43.0

syzbot

unread,
Dec 7, 2025, 9:25:34 PM12/7/25
to linux-...@vger.kernel.org, syzkall...@googlegroups.com
For archival purposes, forwarding an incoming command email to
linux-...@vger.kernel.org, syzkall...@googlegroups.com.

***

Subject: [PATCH] media: dw2102: validate I2C messages in su3000_i2c_transfer()
Author: dharanit...@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²C
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+d99f3a...@syzkaller.appspotmail.com
Fixes: 0e148a522b84 ("media: dw2102: Don't translate i2c read into write")
Signed-off-by: Dharanitharan R <dharanit...@gmail.com>
---
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 *adap, struct i2c_msg msg[],
return -EAGAIN;
}

+ /* Validate incoming I²C messages */
+ if (!msg || num <= 0) {
+ mutex_unlock(&d->data_mutex);
+ mutex_unlock(&d->i2c_mutex);
+ return -EINVAL;
+ }
+
+ for (j = 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 <= 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 = 0;
while (j < num) {
switch (msg[j].addr) {
--
2.43.0

syzbot

unread,
Dec 7, 2025, 9:33:03 PM12/7/25
to linux-...@vger.kernel.org, syzkall...@googlegroups.com
For archival purposes, forwarding an incoming command email to
linux-...@vger.kernel.org, syzkall...@googlegroups.com.

***

Subject: [PATCH] media: dw2102: validate I2C messages in su3000_i2c_transfer()
Author: dharanit...@gmail.com

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²C
messages can still reach the driver through the DVB USB subsystem.

#syz test

Add strict validation of each message to prevent NULL-pointer
dereferences.

Reported-by: syzbot+d99f3a...@syzkaller.appspotmail.com
Fixes: 0e148a522b84 ("media: dw2102: Don't translate i2c read into write")
Reply all
Reply to author
Forward
0 new messages