summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/libfs.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/libfs.c b/fs/libfs.c
index 2319415ddb5e..d6de56a6e183 100644
--- a/fs/libfs.c
+++ b/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))