projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bd8a703
)
tun: fix recovery from gup errors
author
Michael S. Tsirkin
<
[email protected]
>
Sun, 23 Jun 2013 14:19:03 +0000
(17:19 +0300)
committer
David S. Miller
<
[email protected]
>
Tue, 25 Jun 2013 23:16:45 +0000
(16:16 -0700)
get user pages might fail partially in tun zero copy
mode. To recover we need to put all pages that we got,
but code used a wrong index resulting in double-free
errors.
Reported-by: Brad Hubbard <
[email protected]
>
Signed-off-by: Michael S. Tsirkin <
[email protected]
>
Acked-by: Jason Wang <
[email protected]
>
Acked-by: Neil Horman <
[email protected]
>
Signed-off-by: David S. Miller <
[email protected]
>
drivers/net/tun.c
patch
|
blob
|
history
diff --git
a/drivers/net/tun.c
b/drivers/net/tun.c
index bfa9bb48e42d5cfc06e299e64809e29ea3097b5b..9c61f8734a40c09e950505184e39232ead9fa938 100644
(file)
--- a/
drivers/net/tun.c
+++ b/
drivers/net/tun.c
@@
-1010,8
+1010,10
@@
static int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from,
return -EMSGSIZE;
num_pages = get_user_pages_fast(base, size, 0, &page[i]);
if (num_pages != size) {
- for (i = 0; i < num_pages; i++)
- put_page(page[i]);
+ int j;
+
+ for (j = 0; j < num_pages; j++)
+ put_page(page[i + j]);
return -EFAULT;
}
truesize = size * PAGE_SIZE;