[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-api
Subject:    [PATCH 3/5] kdbus: check if lsm permits installing received fds
From:       Karol Lewandowski <k.lewandowsk () samsung ! com>
Date:       2014-10-31 17:19:09
Message-ID: 1414775949-26750-1-git-send-email-k.lewandowsk () samsung ! com
[Download RAW message or body]

From: Karol Lewandowski <lmctlx@gmail.com>

Signed-off-by: Karol Lewandowski <lmctlx@gmail.com>
---
 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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic