On Sat, 16 Feb 2019, Jason Gunthorpe wrote:
diff --git a/drivers/infiniband/hw/qib/qib_user_pages.c b/drivers/infiniband/hw/qib/qib_user_pages.c
index ef8bcf366ddc..123ca8f64f75 100644
+++ b/drivers/infiniband/hw/qib/qib_user_pages.c
@@ -107,7 +107,7 @@ int qib_get_user_pages(unsigned long start_page, size_t num_pages,
lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT;
locked = atomic64_add_return(num_pages, ¤t->mm->pinned_vm);
- if (num_pages > lock_limit && !capable(CAP_IPC_LOCK)) {
+ if (locked > lock_limit && !capable(CAP_IPC_LOCK)) {
ret = -ENOMEM;
goto bail;
Missing atomic_sub ?
Not really the sub is in thhe bail part when we return non-zero.
Thanks,
Davidlohr