Skip to content

Commit

Permalink
ia64/err-inject: Use get_user_pages_fast()
Browse files Browse the repository at this point in the history
At the point of sysfs callback, the call to gup is
done without mmap_sem (or any lock for that matter).
This is racy. As such, use the get_user_pages_fast()
alternative and safely avoid taking the lock, if possible.

Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Signed-off-by: Tony Luck <tony.luck@intel.com>
  • Loading branch information
Davidlohr Bueso authored and Tony Luck committed Mar 5, 2018
1 parent 339d541 commit 69c9070
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/ia64/kernel/err_inject.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ store_virtual_to_phys(struct device *dev, struct device_attribute *attr,
u64 virt_addr=simple_strtoull(buf, NULL, 16);
int ret;

ret = get_user_pages(virt_addr, 1, FOLL_WRITE, NULL, NULL);
ret = get_user_pages_fast(virt_addr, 1, FOLL_WRITE, NULL);
if (ret<=0) {
#ifdef ERR_INJ_DEBUG
printk("Virtual address %lx is not existing.\n",virt_addr);
Expand Down

0 comments on commit 69c9070

Please sign in to comment.