mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Edward Adam Davis <eadavis@qq.com>
To: syzbot+d2125fcb6aa8c4276fd2@syzkaller.appspotmail.com
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [fs?] general protection fault in iter_file_splice_write
Date: Wed, 22 May 2024 13:21:48 +0800	[thread overview]
Message-ID: <tencent_11C652F8465D499BEEC06EC00CAFE7D30606@qq.com> (raw)
In-Reply-To: <0000000000002fd2de0618de2e65@google.com>

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 218e24b1ac40..1a3c31f3e63a 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -392,6 +392,7 @@ ssize_t copy_splice_read(struct file *in, loff_t *ppos,
 			.offset	= 0,
 			.len	= chunk,
 		};
+		printk("buf: %p, ops: %p, %s\n", buf, buf->ops, __func__);
 		pipe->head++;
 		remain -= chunk;
 	}
@@ -498,6 +499,7 @@ static inline bool eat_empty_buffer(struct pipe_inode_info *pipe)
 	unsigned int mask = pipe->ring_size - 1;
 	struct pipe_buffer *buf = &pipe->bufs[tail & mask];
 
+	printk("buf: %p, ops: %p, tail: %d %s\n", buf, buf->ops, tail, __func__);
 	if (unlikely(!buf->len)) {
 		pipe_buf_release(pipe, buf);
 		pipe->tail = tail+1;
@@ -755,8 +757,11 @@ iter_file_splice_write(struct pipe_inode_info *pipe, struct file *out,
 			struct pipe_buffer *buf = &pipe->bufs[tail & mask];
 			if (ret >= buf->len) {
 				ret -= buf->len;
-				buf->len = 0;
-				pipe_buf_release(pipe, buf);
+				printk("buf: %p, ops: %p, buf len: %d, tail: %d, ret: %d, tl: %llu, %s\n", buf, buf->ops, buf->len, tail, ret, sd.total_len, __func__);
+				if (buf->len) {
+					buf->len = 0;
+					pipe_buf_release(pipe, buf);
+				}
 				tail++;
 				pipe->tail = tail;
 				if (pipe->files)
@@ -1483,6 +1488,7 @@ static ssize_t iter_to_pipe(struct iov_iter *from,
 					put_page(pages[i]);
 				goto out;
 			}
+			printk("buf: %p, size: %lu, left: %lu, total: %lu, ret: %lu, %s\n", buf, buf.len, left, total, ret, __func__);
 			total += ret;
 			left -= size;
 			start = 0;


  reply	other threads:[~2024-05-22  5:28 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-20  8:06 syzbot
2024-05-22  5:21 ` Edward Adam Davis [this message]
2024-05-22  5:45   ` syzbot
2024-05-22 10:37 ` Edward Adam Davis
2024-05-22 10:57   ` syzbot
2024-05-22 11:30 ` Edward Adam Davis
2024-05-22 11:56   ` syzbot
2024-05-22 12:49 ` Edward Adam Davis
2024-05-22 13:13   ` syzbot
2024-05-22 13:29 ` Edward Adam Davis
2024-05-22 13:54   ` syzbot
2024-05-22 14:05 ` Edward Adam Davis
2024-05-22 14:30   ` syzbot
2024-05-23  8:33 ` [syzbot] " syzbot
2024-05-23  9:23 ` syzbot
2024-05-23 12:33 ` Edward Adam Davis
2024-05-23 12:58   ` syzbot
2024-05-23 14:13 ` Edward Adam Davis
2024-05-23 14:37   ` syzbot
2024-05-24  0:52 ` [syzbot] " syzbot
2024-05-24  1:30 ` syzbot
2024-05-24  2:07 ` syzbot
2024-05-24  3:51 ` syzbot
2024-05-24  5:35 ` [PATCH] netfs: if extracting pages from user iterator fails return 0 Lizhi Xu
2024-08-11 22:43 ` [syzbot] [fs?] general protection fault in iter_file_splice_write syzbot
2025-09-23 19:59 ` syzbot
2025-09-25 12:47   ` David Howells
     [not found] <20240523083332.761304-1-lizhi.xu@windriver.com>
2024-05-23  8:58 ` syzbot
     [not found] <20240523092352.1279292-1-lizhi.xu@windriver.com>
2024-05-23  9:36 ` syzbot
     [not found] <20240524005225.2834298-1-lizhi.xu@windriver.com>
2024-05-24  1:15 ` syzbot
     [not found] <20240524012956.3069071-1-lizhi.xu@windriver.com>
2024-05-24  1:51 ` syzbot
     [not found] <20240524020717.1126466-1-lizhi.xu@windriver.com>
2024-05-24  2:31 ` syzbot
     [not found] <20240524035136.1561347-1-lizhi.xu@windriver.com>
2024-05-24  4:16 ` syzbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tencent_11C652F8465D499BEEC06EC00CAFE7D30606@qq.com \
    --to=eadavis@qq.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+d2125fcb6aa8c4276fd2@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®