lkml.org 
[lkml]   [2015]   [Jun]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/3] driver: core: add security labels to misc class devnode
Date
Add support for setting security labels on devtmpfs nodes created
by misc class drivers using misc_register.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Vivek Trivedi <t.vivek@samsung.com>
---
drivers/char/misc.c | 5 +++++
include/linux/miscdevice.h | 2 ++
2 files changed, 7 insertions(+)

diff --git a/drivers/char/misc.c b/drivers/char/misc.c
index 63fb739..42fc006 100644
--- a/drivers/char/misc.c
+++ b/drivers/char/misc.c
@@ -274,6 +274,11 @@ static char *misc_devnode(struct device *dev, umode_t *mode,

if (mode && c->mode)
*mode = c->mode;
+ if (xattr && xattr->value && c->xattr_value) {
+ xattr->name = c->xattr_name;
+ strcpy(xattr->value, c->xattr_value);
+ xattr->value_len = strlen(xattr->value);
+ }
if (c->nodename)
return kstrdup(c->nodename, GFP_KERNEL);
return NULL;
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 819077c..bcc3d8e 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -64,6 +64,8 @@ struct miscdevice {
const struct attribute_group **groups;
const char *nodename;
umode_t mode;
+ const char *xattr_name;
+ const char *xattr_value;
};

extern int misc_register(struct miscdevice *misc);
--
1.8.5.5


\
 
 \ /
  Last update: 2015-06-05 12:41    [W:2.048 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site