teknoraver / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone
Blob Blame History Raw
From 415796b7022e7f7756effbaf795bf46bbb6cba5f Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 17 Jun 2014 23:51:21 +0200
Subject: [PATCH] namespace: properly label device nodes we create

https://bugzilla.redhat.com/show_bug.cgi?id=1081429
(cherry picked from commit dd078a1ef844d2ab66b8fb1e58dd73522262fad6)
---
 src/core/namespace.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/core/namespace.c b/src/core/namespace.c
index 3b5402b7..d1513ce2 100644
--- a/src/core/namespace.c
+++ b/src/core/namespace.c
@@ -42,6 +42,7 @@
 #include "mkdir.h"
 #include "dev-setup.h"
 #include "def.h"
+#include "label.h"
 
 typedef enum MountMode {
         /* This is ordered by priority! */
@@ -223,7 +224,10 @@ static int mount_dev(BindMount *m) {
                         goto fail;
                 }
 
+                label_context_set(d, st.st_mode);
                 r = mknod(dn, st.st_mode, st.st_rdev);
+                label_context_clear();
+
                 if (r < 0) {
                         r = -errno;
                         goto fail;