summaryrefslogtreecommitdiff
path: root/net/core
diff options
context:
space:
mode:
authorJason Wang <jasowang@redhat.com>2013-08-06 13:45:07 +0400
committerDavid S. Miller <davem@davemloft.net>2013-08-08 03:52:38 +0400
commit0433547aa7443cefc89d9b533169bdc50f1206b8 (patch)
treeffb3ad0b9f34b845340262db63046b49bca2e7cc /net/core
parent234a4267085e85d0cc5552c340833bb2d82a50e7 (diff)
downloadlinux-0433547aa7443cefc89d9b533169bdc50f1206b8.tar.xz
net: use release_pages() in zerocopy_sg_from_iovec()
To reduce the duplicated codes. Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/datagram.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/net/core/datagram.c b/net/core/datagram.c
index a8a795cfeff5..badcd93e5dd8 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -48,6 +48,7 @@
#include <linux/highmem.h>
#include <linux/spinlock.h>
#include <linux/slab.h>
+#include <linux/pagemap.h>
#include <net/protocol.h>
#include <linux/skbuff.h>
@@ -638,10 +639,7 @@ 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) {
- int j;
-
- for (j = 0; j < num_pages; j++)
- put_page(page[i + j]);
+ release_pages(&page[i], num_pages, 0);
return -EFAULT;
}
truesize = size * PAGE_SIZE;