summaryrefslogtreecommitdiff
path: root/net/xdp/xdp_umem.c
diff options
context:
space:
mode:
authorSean Paul <seanpaul@chromium.org>2019-03-06 09:22:18 -0500
committerSean Paul <seanpaul@chromium.org>2019-03-06 09:22:18 -0500
commitcd7d3a1bb42e0756b17ccfafbd956ca7ed757846 (patch)
treefb76fd0ccaaaa3f27ef0a06ecf3d04ebe9d4025d /net/xdp/xdp_umem.c
parent6b5c029df5e40704a6642e026e709dd0dec44622 (diff)
parent4b057e73f28f1df13b77b77a52094238ffdf8abd (diff)
Merge drm/drm-next into drm-misc-next
Picking up v5.0 + missed misc-fixes from last release Signed-off-by: Sean Paul <seanpaul@chromium.org>
Diffstat (limited to 'net/xdp/xdp_umem.c')
-rw-r--r--net/xdp/xdp_umem.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/net/xdp/xdp_umem.c b/net/xdp/xdp_umem.c
index d4de871e7d4d..37e1fe180769 100644
--- a/net/xdp/xdp_umem.c
+++ b/net/xdp/xdp_umem.c
@@ -125,9 +125,10 @@ int xdp_umem_assign_dev(struct xdp_umem *umem, struct net_device *dev,
return 0;
err_unreg_umem:
- xdp_clear_umem_at_qid(dev, queue_id);
if (!force_zc)
err = 0; /* fallback to copy mode */
+ if (err)
+ xdp_clear_umem_at_qid(dev, queue_id);
out_rtnl_unlock:
rtnl_unlock();
return err;
@@ -259,10 +260,10 @@ static int xdp_umem_pin_pages(struct xdp_umem *umem)
if (!umem->pgs)
return -ENOMEM;
- down_write(&current->mm->mmap_sem);
- npgs = get_user_pages(umem->address, umem->npgs,
- gup_flags, &umem->pgs[0], NULL);
- up_write(&current->mm->mmap_sem);
+ down_read(&current->mm->mmap_sem);
+ npgs = get_user_pages_longterm(umem->address, umem->npgs,
+ gup_flags, &umem->pgs[0], NULL);
+ up_read(&current->mm->mmap_sem);
if (npgs != umem->npgs) {
if (npgs >= 0) {