mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-31 04:01:48 -04:00
libfs: make simple attributes interruptible
Use mutex_lock_interruptible in simple_attr_read/write. Signed-off-by: Christoph Hellwig <[email protected]> Cc: <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Greg KH <[email protected]> Cc: Al Viro <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
8b88b0998e
commit
9261303ab7
1 changed files with 8 additions and 2 deletions
10
fs/libfs.c
10
fs/libfs.c
|
|
@ -634,7 +634,10 @@ ssize_t simple_attr_read(struct file *file, char __user *buf,
|
|||
if (!attr->get)
|
||||
return -EACCES;
|
||||
|
||||
mutex_lock(&attr->mutex);
|
||||
ret = mutex_lock_interruptible(&attr->mutex);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (*ppos) { /* continued read */
|
||||
size = strlen(attr->get_buf);
|
||||
} else { /* first read */
|
||||
|
|
@ -666,7 +669,10 @@ ssize_t simple_attr_write(struct file *file, const char __user *buf,
|
|||
if (!attr->set)
|
||||
return -EACCES;
|
||||
|
||||
mutex_lock(&attr->mutex);
|
||||
ret = mutex_lock_interruptible(&attr->mutex);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = -EFAULT;
|
||||
size = min(sizeof(attr->set_buf) - 1, len);
|
||||
if (copy_from_user(attr->set_buf, buf, size))
|
||||
|
|
|
|||
Loading…
Reference in a new issue