ia64/err-inject: Use get_user_pages_fast()
PATCH 1/1 ia64/err-inject: Use get_user_pages_fast()
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.
--- arch/ia64/kernel/err_inject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/ia64/kernel/err_inject.c +1 -1
@@ -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);
Signature · 1 line
2.13.6
ping
Quoted 26 lines · Davidlohr Bueso
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 theget_user_pages_fast()alternative and safely avoid taking the lock, if possible.Signed-off-by Davidlohr Bueso <[email protected]>---
arch/ia64/kernel/err_inject.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)arch/ia64/kernel/err_inject.c +1
-1@@ -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);Signature · 1 line
2.13.6
Andrew, if you're ok with the patch below, could it be routed your way?
Thanks,
Davidlohr
Quoted 26 lines · Davidlohr Bueso
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 theget_user_pages_fast()alternative and safely avoid taking the lock, if possible.Signed-off-by Davidlohr Bueso <[email protected]>---
arch/ia64/kernel/err_inject.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)arch/ia64/kernel/err_inject.c +1
-1@@ -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);Signature · 1 line
2.13.6