All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark McLoughlin <markmc@redhat.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: virtualization@lists.osdl.org
Subject: Re: [3/6] [TUN]: Fix GSO mapping
Date: Thu, 29 May 2008 11:32:51 +0100	[thread overview]
Message-ID: <1212057171.21998.2.camel@muff> (raw)
In-Reply-To: <20080418031722.GB18071@gondor.apana.org.au>

On Fri, 2008-04-18 at 11:17 +0800, Herbert Xu wrote:
> This patch avoids the correctness issue on the user-space mapping
> by just copying the memory.
> 
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index 4c15dc4..d75cfd2 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c

> +			virt = kmap_atomic(f->page, KM_USER0);
> +			err = memcpy_fromiovec(virt + f->size, iv, copy);
> +			kunmap_atomic(virt, KM_USER0);

Seeing an oops from this; fix below.

Cheers,
Mark.

Subject: [PATCH 1/1] tun: Do not use kmap_atomic() since memcpy_fromiovec() can sleep

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
---
 drivers/net/tun.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 151b409..aff338e 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -322,9 +322,9 @@ static int get_user_skb_frags(struct iovec *iv, size_t count,
 			if (copy > len)
 				copy = len;
 
-			virt = kmap_atomic(f->page, KM_USER0);
+			virt = kmap(f->page);
 			err = memcpy_fromiovec(virt + f->size, iv, copy);
-			kunmap_atomic(virt, KM_USER0);
+			kunmap(f->page);
 
 			if (err)
 				return err;

  parent reply	other threads:[~2008-05-29 10:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-18  3:12 [0/6] [NET]: virtio SG/TSO patches Herbert Xu
2008-04-18  3:14 ` [1/6] [TUN]: Add GSO support Herbert Xu
2008-04-18  3:15   ` [2/6] [TUN]: Add GSO detection Herbert Xu
2008-04-18  3:17     ` [3/6] [TUN]: Fix GSO mapping Herbert Xu
2008-04-18  3:19       ` [4/6] [KVM] virtio-net: Add SG/GSO support Herbert Xu
2008-04-18  3:21         ` [5/6] [VIRTIO] net: Add ethtool ops for SG/GSO Herbert Xu
2008-04-18  3:24           ` [6/6] [VIRTIO] net: Allow receiving SG packets Herbert Xu
2008-04-18 14:08             ` Rusty Russell
2008-04-18 14:30               ` Herbert Xu
2008-04-21 19:06             ` Rusty Russell
2008-04-21 20:04               ` David Miller
2008-04-22  1:13                 ` Herbert Xu
2008-04-22  2:50                 ` Rusty Russell
2008-04-22  2:55                   ` David Miller
2008-04-21 19:01           ` [5/6] [VIRTIO] net: Add ethtool ops for SG/GSO Rusty Russell
2008-04-22  1:15             ` Herbert Xu
2008-04-22  2:44               ` Rusty Russell
2008-05-29 10:32       ` Mark McLoughlin [this message]
2008-05-29 10:38         ` [3/6] [TUN]: Fix GSO mapping Herbert Xu

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=1212057171.21998.2.camel@muff \
    --to=markmc@redhat.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=virtualization@lists.osdl.org \
    /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 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.