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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240411153126.16201-317-axboe@kernel.dk>
Date: Thu, 11 Apr 2024 09:17:36 -0600
From: Jens Axboe <axboe@...nel.dk>
To: linux-kernel@...r.kernel.org
Cc: Jens Axboe <axboe@...nel.dk>
Subject: [PATCH 316/437] drivers/net/ppp: convert to read/write iterators

Signed-off-by: Jens Axboe <axboe@...nel.dk>
---
 drivers/net/ppp/ppp_generic.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index fe380fe196e7..6601b6c3e2b2 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -492,11 +492,12 @@ static ssize_t ppp_read(struct file *file, char __user *buf,
  out:
 	return ret;
 }
+FOPS_READ_ITER_HELPER(ppp_read);
 
-static ssize_t ppp_write(struct file *file, const char __user *buf,
-			 size_t count, loff_t *ppos)
+static ssize_t ppp_write(struct kiocb *iocb, struct iov_iter *from)
 {
-	struct ppp_file *pf = file->private_data;
+	struct ppp_file *pf = iocb->ki_filp->private_data;
+	size_t count = iov_iter_count(from);
 	struct sk_buff *skb;
 	ssize_t ret;
 
@@ -511,7 +512,7 @@ static ssize_t ppp_write(struct file *file, const char __user *buf,
 		goto out;
 	skb_reserve(skb, pf->hdrlen);
 	ret = -EFAULT;
-	if (copy_from_user(skb_put(skb, count), buf, count)) {
+	if (!copy_from_iter_full(skb_put(skb, count), count, from)) {
 		kfree_skb(skb);
 		goto out;
 	}
@@ -1092,8 +1093,8 @@ static int ppp_unattached_ioctl(struct net *net, struct ppp_file *pf,
 
 static const struct file_operations ppp_device_fops = {
 	.owner		= THIS_MODULE,
-	.read		= ppp_read,
-	.write		= ppp_write,
+	.read_iter	= ppp_read_iter,
+	.write_iter	= ppp_write,
 	.poll		= ppp_poll,
 	.unlocked_ioctl	= ppp_ioctl,
 #ifdef CONFIG_COMPAT
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ