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>
This commit is contained in:
parent
234a426708
commit
0433547aa7
|
@ -48,6 +48,7 @@
|
||||||
#include <linux/highmem.h>
|
#include <linux/highmem.h>
|
||||||
#include <linux/spinlock.h>
|
#include <linux/spinlock.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
|
#include <linux/pagemap.h>
|
||||||
|
|
||||||
#include <net/protocol.h>
|
#include <net/protocol.h>
|
||||||
#include <linux/skbuff.h>
|
#include <linux/skbuff.h>
|
||||||
|
@ -638,10 +639,7 @@ int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from,
|
||||||
return -EMSGSIZE;
|
return -EMSGSIZE;
|
||||||
num_pages = get_user_pages_fast(base, size, 0, &page[i]);
|
num_pages = get_user_pages_fast(base, size, 0, &page[i]);
|
||||||
if (num_pages != size) {
|
if (num_pages != size) {
|
||||||
int j;
|
release_pages(&page[i], num_pages, 0);
|
||||||
|
|
||||||
for (j = 0; j < num_pages; j++)
|
|
||||||
put_page(page[i + j]);
|
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
truesize = size * PAGE_SIZE;
|
truesize = size * PAGE_SIZE;
|
||||||
|
|
Loading…
Reference in New Issue