summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-11-22 13:19:21 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2011-11-22 13:19:21 -0800
commit2db1125d51c4752ca68d1f015347b6f5b55e9fca (patch)
tree6f63b43c99b9b612b4ec3f8a673160fa3fe75111 /drivers
parent866d43c9ea88daa3751b58aba16a2a9b7f7aa067 (diff)
parentd31da0f0ba3bc0a827a63879310818c22d9a95be (diff)
downloadlinux-3.10-2db1125d51c4752ca68d1f015347b6f5b55e9fca.tar.gz
linux-3.10-2db1125d51c4752ca68d1f015347b6f5b55e9fca.tar.bz2
linux-3.10-2db1125d51c4752ca68d1f015347b6f5b55e9fca.zip
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: mount_subtree() pointless use-after-free iio: fix a leak due to improper use of anon_inode_getfd() microblaze: bury asm/namei.h
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/iio/industrialio-core.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/staging/iio/industrialio-core.c b/drivers/staging/iio/industrialio-core.c
index 326e967d54e..26564094e33 100644
--- a/drivers/staging/iio/industrialio-core.c
+++ b/drivers/staging/iio/industrialio-core.c
@@ -242,6 +242,8 @@ static const struct file_operations iio_event_chrdev_fileops = {
static int iio_event_getfd(struct iio_dev *indio_dev)
{
+ int fd;
+
if (indio_dev->event_interface == NULL)
return -ENODEV;
@@ -252,9 +254,15 @@ static int iio_event_getfd(struct iio_dev *indio_dev)
return -EBUSY;
}
mutex_unlock(&indio_dev->event_interface->event_list_lock);
- return anon_inode_getfd("iio:event",
+ fd = anon_inode_getfd("iio:event",
&iio_event_chrdev_fileops,
indio_dev->event_interface, O_RDONLY);
+ if (fd < 0) {
+ mutex_lock(&indio_dev->event_interface->event_list_lock);
+ clear_bit(IIO_BUSY_BIT_POS, &ev_int->flags);
+ mutex_unlock(&indio_dev->event_interface->event_list_lock);
+ }
+ return fd;
}
static int __init iio_init(void)