[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0000000000000112a20619289539@google.com>
Date: Thu, 23 May 2024 17:52:29 -0700
From: syzbot <syzbot+d2125fcb6aa8c4276fd2@...kaller.appspotmail.com>
To: linux-kernel@...r.kernel.org
Subject: Re: [syzbot] [syzbot] [fs?] general protection fault in iter_file_splice_write
For archival purposes, forwarding an incoming command email to
linux-kernel@...r.kernel.org.
***
Subject: [syzbot] [fs?] general protection fault in iter_file_splice_write
Author: lizhi.xu@...driver.com
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 33e02dc69afb
diff --git a/fs/splice.c b/fs/splice.c
index 60aed8de21f8..2df64a29c568 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -745,16 +745,30 @@ iter_file_splice_write(struct pipe_inode_info *pipe, struct file *out,
if (ret <= 0)
break;
+ printk("ret: %ld, total len: %lu, %s\n", ret, sd.total_len, __func__);
+ if (ret > sd.total_len) {
+ ret = -EINVAL;
+ goto done;
+ }
sd.num_spliced += ret;
sd.total_len -= ret;
*ppos = sd.pos;
/* dismiss the fully eaten buffers, adjust the partial one */
tail = pipe->tail;
- while (ret) {
+ n = 0;
+ while (ret > 0 && n < nbufs) {
struct pipe_buffer *buf = &pipe->bufs[tail & mask];
+ n++;
+ if (!buf->len) {
+ tail++;
+ continue;
+ }
if (ret >= buf->len) {
+ printk("ret: %ld, nbufs: %d, buf:%p, buf len: %u, m: %u, t: %u,ring size: %u, t&m: %u, n:%d, %s\n",
+ ret, nbufs, buf, buf->len, mask, tail, pipe->ring_size, tail & mask, n, __func__);
ret -= buf->len;
+ printk("ret: %ld, %s\n", ret, __func__);
buf->len = 0;
pipe_buf_release(pipe, buf);
tail++;
Powered by blists - more mailing lists