Commit 7fe9a937 authored by Daniel Walter's avatar Daniel Walter Committed by Felipe Balbi

usb: gadget: functionfs: fix missing access_ok checks

use safe copy_*_user instead of unsafe __copy_*_user
functions when accessing userland memory.
Signed-off-by: default avatarDaniel Walter <dwalter@sigma-star.at>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 183e53e8
...@@ -423,7 +423,7 @@ static ssize_t __ffs_ep0_read_events(struct ffs_data *ffs, char __user *buf, ...@@ -423,7 +423,7 @@ static ssize_t __ffs_ep0_read_events(struct ffs_data *ffs, char __user *buf,
spin_unlock_irq(&ffs->ev.waitq.lock); spin_unlock_irq(&ffs->ev.waitq.lock);
mutex_unlock(&ffs->mutex); mutex_unlock(&ffs->mutex);
return unlikely(__copy_to_user(buf, events, size)) ? -EFAULT : size; return unlikely(copy_to_user(buf, events, size)) ? -EFAULT : size;
} }
static ssize_t ffs_ep0_read(struct file *file, char __user *buf, static ssize_t ffs_ep0_read(struct file *file, char __user *buf,
...@@ -513,7 +513,7 @@ static ssize_t ffs_ep0_read(struct file *file, char __user *buf, ...@@ -513,7 +513,7 @@ static ssize_t ffs_ep0_read(struct file *file, char __user *buf,
/* unlocks spinlock */ /* unlocks spinlock */
ret = __ffs_ep0_queue_wait(ffs, data, len); ret = __ffs_ep0_queue_wait(ffs, data, len);
if (likely(ret > 0) && unlikely(__copy_to_user(buf, data, len))) if (likely(ret > 0) && unlikely(copy_to_user(buf, data, len)))
ret = -EFAULT; ret = -EFAULT;
goto done_mutex; goto done_mutex;
...@@ -3493,7 +3493,7 @@ static char *ffs_prepare_buffer(const char __user *buf, size_t len) ...@@ -3493,7 +3493,7 @@ static char *ffs_prepare_buffer(const char __user *buf, size_t len)
if (unlikely(!data)) if (unlikely(!data))
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
if (unlikely(__copy_from_user(data, buf, len))) { if (unlikely(copy_from_user(data, buf, len))) {
kfree(data); kfree(data);
return ERR_PTR(-EFAULT); return ERR_PTR(-EFAULT);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment