From: Jason Wang Date: Tue, 6 Aug 2013 09:45:07 +0000 (+0800) Subject: net: use release_pages() in zerocopy_sg_from_iovec() X-Git-Tag: v3.12-rc1~132^2~330 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0433547aa7443cefc89d9b533169bdc50f1206b8;p=profile%2Fivi%2Fkernel-x86-ivi.git net: use release_pages() in zerocopy_sg_from_iovec() To reduce the duplicated codes. Signed-off-by: Jason Wang Signed-off-by: David S. Miller --- diff --git a/net/core/datagram.c b/net/core/datagram.c index a8a795c..badcd93 100644 --- a/net/core/datagram.c +++ b/net/core/datagram.c @@ -48,6 +48,7 @@ #include #include #include +#include #include #include @@ -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;