summaryrefslogtreecommitdiff
path: root/drivers/iio
diff options
context:
space:
mode:
authorJoel Stanley <joel@jms.id.au>2022-02-17 13:39:23 +0300
committerJoel Stanley <joel@jms.id.au>2022-02-17 13:39:32 +0300
commit2befcc6bb0bb1e0a4a31391a359adcab3925b6e4 (patch)
treeacc6a7f8231c44844aac6c304e79c6d2de0a601a /drivers/iio
parentfb55a38ae174af9f4ae45d9933dc9503356cfc38 (diff)
parenta0ebea480bb319a3ad408c99db91262dbc696b76 (diff)
downloadlinux-2befcc6bb0bb1e0a4a31391a359adcab3925b6e4.tar.xz
Merge tag 'v5.15.24' into dev-5.15
This is the 5.15.24 stable release Signed-off-by: Joel Stanley <joel@jms.id.au>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/industrialio-buffer.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
index 2f98ba70e3d7..c81dbd2f0972 100644
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -1446,9 +1446,17 @@ static long iio_device_buffer_getfd(struct iio_dev *indio_dev, unsigned long arg
}
if (copy_to_user(ival, &fd, sizeof(fd))) {
- put_unused_fd(fd);
- ret = -EFAULT;
- goto error_free_ib;
+ /*
+ * "Leak" the fd, as there's not much we can do about this
+ * anyway. 'fd' might have been closed already, as
+ * anon_inode_getfd() called fd_install() on it, which made
+ * it reachable by userland.
+ *
+ * Instead of allowing a malicious user to play tricks with
+ * us, rely on the process exit path to do any necessary
+ * cleanup, as in releasing the file, if still needed.
+ */
+ return -EFAULT;
}
return 0;