lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240411153126.16201-43-axboe@kernel.dk>
Date: Thu, 11 Apr 2024 09:13:02 -0600
From: Jens Axboe <axboe@...nel.dk>
To: linux-kernel@...r.kernel.org
Cc: Jens Axboe <axboe@...nel.dk>
Subject: [PATCH 042/437] ceph: convert read_dir handler to read_iter()

Signed-off-by: Jens Axboe <axboe@...nel.dk>
---
 fs/ceph/dir.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index 0e9f56eaba1e..3397b24f9e1a 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -2110,12 +2110,13 @@ static void ceph_d_prune(struct dentry *dentry)
  * read() on a dir.  This weird interface hack only works if mounted
  * with '-o dirstat'.
  */
-static ssize_t ceph_read_dir(struct file *file, char __user *buf, size_t size,
-			     loff_t *ppos)
+static ssize_t ceph_read_dir(struct kiocb *iocb, struct iov_iter *to)
 {
+	struct file *file = iocb->ki_filp;
 	struct ceph_dir_file_info *dfi = file->private_data;
 	struct inode *inode = file_inode(file);
 	struct ceph_inode_info *ci = ceph_inode(inode);
+	size_t size;
 	int left;
 	const int bufsize = 1024;
 
@@ -2147,13 +2148,13 @@ static ssize_t ceph_read_dir(struct file *file, char __user *buf, size_t size,
 				ci->i_rctime.tv_nsec);
 	}
 
-	if (*ppos >= dfi->dir_info_len)
+	if (iocb->ki_pos >= dfi->dir_info_len)
 		return 0;
-	size = min_t(unsigned, size, dfi->dir_info_len-*ppos);
-	left = copy_to_user(buf, dfi->dir_info + *ppos, size);
+	size = min_t(unsigned, iov_iter_count(to), dfi->dir_info_len-iocb->ki_pos);
+	left = copy_to_iter(dfi->dir_info + iocb->ki_pos, size, to);
 	if (left == size)
 		return -EFAULT;
-	*ppos += (size - left);
+	iocb->ki_pos += (size - left);
 	return size - left;
 }
 
@@ -2184,7 +2185,7 @@ unsigned ceph_dentry_hash(struct inode *dir, struct dentry *dn)
 
 WRAP_DIR_ITER(ceph_readdir) // FIXME!
 const struct file_operations ceph_dir_fops = {
-	.read = ceph_read_dir,
+	.read_iter = ceph_read_dir,
 	.iterate_shared = shared_ceph_readdir,
 	.llseek = ceph_dir_llseek,
 	.open = ceph_open,
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ