[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_7BA1330A9E431B2B4B071B6B2518BA37BB08@qq.com>
Date: Wed, 22 May 2024 19:30:37 +0800
From: Edward Adam Davis <eadavis@...com>
To: syzbot+d2125fcb6aa8c4276fd2@...kaller.appspotmail.com
Cc: linux-kernel@...r.kernel.org,
syzkaller-bugs@...glegroups.com
Subject: Re: [syzbot] [fs?] general protection fault in iter_file_splice_write
please test null ptr in iter_file_splice_write
#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..db66b8c5fe0d 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -751,21 +751,25 @@ iter_file_splice_write(struct pipe_inode_info *pipe, struct file *out,
/* dismiss the fully eaten buffers, adjust the partial one */
tail = pipe->tail;
- while (ret) {
+ printk("ret: %ld, %s\n", ret, __func__);
+ while (ret > 0) {
struct pipe_buffer *buf = &pipe->bufs[tail & mask];
- if (ret >= buf->len) {
- ret -= buf->len;
- buf->len = 0;
- pipe_buf_release(pipe, buf);
- tail++;
- pipe->tail = tail;
- if (pipe->files)
- sd.need_wakeup = true;
- } else {
- buf->offset += ret;
- buf->len -= ret;
+ if (buf->len > 0) {
+ if (ret >= (ssize_t)buf->len) {
+ ret -= buf->len;
+ buf->len = 0;
+ pipe_buf_release(pipe, buf);
+ tail++;
+ pipe->tail = tail;
+ if (pipe->files)
+ sd.need_wakeup = true;
+ } else {
+ buf->offset += ret;
+ buf->len -= ret;
+ ret = 0;
+ }
+ } else
ret = 0;
- }
}
}
done:
Powered by blists - more mailing lists