[PATCH 3/5] kdbus: check if lsm permits installing received fds

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Karol Lewandowski <lmctlx@xxxxxxxxx>

Signed-off-by: Karol Lewandowski <lmctlx@xxxxxxxxx>
---
 drivers/misc/kdbus/queue.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/misc/kdbus/queue.c b/drivers/misc/kdbus/queue.c
index 6693852..dae18bd 100644
--- a/drivers/misc/kdbus/queue.c
+++ b/drivers/misc/kdbus/queue.c
@@ -25,6 +25,7 @@
 #include <linux/poll.h>
 #include <linux/sched.h>
 #include <linux/sizes.h>
+#include <linux/security.h>
 #include <linux/slab.h>
 #include <linux/syscalls.h>
 
@@ -41,6 +42,18 @@ static int kdbus_queue_entry_fds_install(struct kdbus_queue_entry *entry)
 	int ret, *fds;
 	size_t count;
 
+        for (i = 0; i < entry->fds_count; i++) {
+                ret = security_file_receive(entry->fds_fp[i]);
+                if (ret)
+                        return ret;
+        }
+
+        for (i = 0; i < entry->memfds_count; i++) {
+                ret = security_file_receive(entry->memfds_fp[i]);
+                if (ret)
+                        return ret;
+        }
+
 	/* get array of file descriptors */
 	count = entry->fds_count + entry->memfds_count;
 	if (!count)
-- 
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-api" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux