aboutsummaryrefslogtreecommitdiffstats
path: root/fs/libfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/libfs.c')
-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,
634 if (!attr->get) 634 if (!attr->get)
635 return -EACCES; 635 return -EACCES;
636 636
637 mutex_lock(&attr->mutex); 637 ret = mutex_lock_interruptible(&attr->mutex);
638 if (ret)
639 return ret;
640
638 if (*ppos) { /* continued read */ 641 if (*ppos) { /* continued read */
639 size = strlen(attr->get_buf); 642 size = strlen(attr->get_buf);
640 } else { /* first read */ 643 } else { /* first read */
@@ -666,7 +669,10 @@ ssize_t simple_attr_write(struct file *file, const char __user *buf,
666 if (!attr->set) 669 if (!attr->set)
667 return -EACCES; 670 return -EACCES;
668 671
669 mutex_lock(&attr->mutex); 672 ret = mutex_lock_interruptible(&attr->mutex);
673 if (ret)
674 return ret;
675
670 ret = -EFAULT; 676 ret = -EFAULT;
671 size = min(sizeof(attr->set_buf) - 1, len); 677 size = min(sizeof(attr->set_buf) - 1, len);
672 if (copy_from_user(attr->set_buf, buf, size)) 678 if (copy_from_user(attr->set_buf, buf, size))