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: <1416785390.7215.61.camel@decadent.org.uk>
Date:	Sun, 23 Nov 2014 23:29:50 +0000
From:	Ben Hutchings <ben@...adent.org.uk>
To:	Al Viro <viro@...IV.linux.org.uk>
Cc:	David Miller <davem@...emloft.net>, torvalds@...ux-foundation.org,
	netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
	target-devel@...r.kernel.org, nab@...ux-iscsi.org,
	hch@...radead.org
Subject: Re: [PATCH 06/17] switch macvtap to ->read_iter()

On Sat, 2014-11-22 at 04:32 +0000, Al Viro wrote:
> Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
> ---
>  drivers/net/macvtap.c |   39 ++++++++++++++++-----------------------
>  1 file changed, 16 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
> index cea99d4..cdd820f 100644
> --- a/drivers/net/macvtap.c
> +++ b/drivers/net/macvtap.c
> @@ -829,16 +829,17 @@ done:
>  }
>  
>  static ssize_t macvtap_do_read(struct macvtap_queue *q,
> -			       const struct iovec *iv, unsigned long segs,
> -			       unsigned long len,
> +			       struct iov_iter *to,
>  			       int noblock)
>  {
>  	DEFINE_WAIT(wait);
>  	struct sk_buff *skb;
>  	ssize_t ret = 0;
> -	struct iov_iter iter;
>  
> -	while (len) {
> +	if (!iov_iter_count(to))
> +		return 0;
> +
> +	while (1) {
>  		if (!noblock)
>  			prepare_to_wait(sk_sleep(&q->sk), &wait,
>  					TASK_INTERRUPTIBLE);
> @@ -856,37 +857,27 @@ static ssize_t macvtap_do_read(struct macvtap_queue *q,
>  			}
>  			/* Nothing to read, let's sleep */
>  			schedule();
> -			continue;
>  		}
> -		iov_iter_init(&iter, READ, iv, segs, len);
> -		ret = macvtap_put_user(q, skb, &iter);
> +	}
> +	if (skb) {
> +		ret = macvtap_put_user(q, skb, to);
>  		kfree_skb(skb);
> -		break;
[...]

You need to leave this break at the bottom of the loop body, or change
it to:

	do {
		...
	} while (!skb);

Ben.

-- 
Ben Hutchings
Never put off till tomorrow what you can avoid all together.

Download attachment "signature.asc" of type "application/pgp-signature" (812 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ