All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix: general protection fault in iter_file_splice_write
@ 2024-11-04  8:42 Daniel Yang
  2024-11-04 12:06 ` Jan Kara
  2024-11-04 17:12 ` Al Viro
  0 siblings, 2 replies; 4+ messages in thread
From: Daniel Yang @ 2024-11-04  8:42 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, Jan Kara,
	open list:FILESYSTEMS (VFS and infrastructure), open list
  Cc: Daniel Yang, syzbot+d2125fcb6aa8c4276fd2

The function iter_file_splice_write() calls pipe_buf_release() which has
a nullptr dereference in ops->release. Add check for buf->ops not null
before calling pipe_buf_release().

Signed-off-by: Daniel Yang <danielyangkang@gmail.com>
Reported-by: syzbot+d2125fcb6aa8c4276fd2@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=d2125fcb6aa8c4276fd2
Fixes: 2df86547b23d ("netfs: Cut over to using new writeback code")
---
 fs/splice.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/splice.c b/fs/splice.c
index 06232d7e5..b8c503e47 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -756,7 +756,8 @@ iter_file_splice_write(struct pipe_inode_info *pipe, struct file *out,
 			if (ret >= buf->len) {
 				ret -= buf->len;
 				buf->len = 0;
-				pipe_buf_release(pipe, buf);
+				if (buf->ops)
+					pipe_buf_release(pipe, buf);
 				tail++;
 				pipe->tail = tail;
 				if (pipe->files)
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-11-04 17:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-04  8:42 [PATCH] fix: general protection fault in iter_file_splice_write Daniel Yang
2024-11-04 12:06 ` Jan Kara
2024-11-04 16:54   ` Daniel Yang
2024-11-04 17:12 ` Al Viro

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.