Skip to contentSkip to conversation

binder: Return EFAULT if we fail BINDER_ENABLE_ONEWAY_SPAM_DETECTION

PATCH In review Luca Stefani 3 participants 3 messages May 6, 2021 – May 7, 2021 Android drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 binder: Return EFAULT if we fail BINDER_ENABLE_ONEWAY_SPAM_DETECTION

All the other ioctl paths return EFAULT in case the copy_from_user/copy_to_user call fails, make oneway spam detection follow the same paradigm.

Fixes a7dc1e6f99df ("binder: tell userspace to dump current backtrace

when detected oneway spamming")

---
 drivers/android/binder.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/android/binder.c +1 -1
index 61d34e1dc59c..bcec598b89f2 100644
@@ -4918,7 +4918,7 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 		uint32_t enable;
 
 		if (copy_from_user(&enable, ubuf, sizeof(enable))) {
-			ret = -EINVAL;
+			ret = -EFAULT;
 			goto err;
 		}
 		binder_inner_proc_lock(proc);
Signature · 1 line
2.31.1
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Luca Stefani

All the other ioctl paths return EFAULT in case the copy_from_user/copy_to_user call fails, make oneway spam detection follow the same paradigm.

Fixes a7dc1e6f99df ("binder: tell userspace to dump current backtrace

when detected oneway spamming")

Quoted 20 lines
---
 drivers/android/binder.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/android/binder.c +1 -2
index 61d34e1dc59c..bcec598b89f2 100644
@@ -4918,7 +4918,7 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
                uint32_t enable;
 
                if (copy_from_user(&enable, ubuf, sizeof(enable))) {
-                       ret = -EINVAL;
+                       ret = -EFAULT;
                        goto err;
                }
                binder_inner_proc_lock(proc);
--

2.31.1