Thread (19 messages) 19 messages, 4 authors, 2008-05-29

Re: [3/6] [TUN]: Fix GSO mapping

From: Mark McLoughlin <hidden>
Date: 2008-05-29 10:32:51
Subsystem: networking drivers, the rest, tun/tap driver · Maintainers: Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds, Willem de Bruijn, Jason Wang

On Fri, 2008-04-18 at 11:17 +0800, Herbert Xu wrote:
quoted hunk ↗ jump to hunk
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 <redacted>
---
 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;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help