Skip to contentSkip to conversation

driver: core: add security labels to misc class devnode

PATCH In review Namjae Jeon 2 participants 4 messages Jun 5, 2015 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 3/3 driver: core: add security labels to misc class devnode

Add support for setting security labels on devtmpfs nodes created by misc class drivers using misc_register.

---
 drivers/char/misc.c        | 5 +++++
 include/linux/miscdevice.h | 2 ++
 2 files changed, 7 insertions(+)
drivers/char/misc.c +5 -0
index 63fb739..42fc006 100644
@@ -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;
include/linux/miscdevice.h +2 -0
index 819077c..bcc3d8e 100644
@@ -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);
Signature · 1 line
1.8.5.5
#2 lore raw
Quoted 8 lines · Namjae Jeon
Quoted 5 lines

Add support for setting security labels on devtmpfs nodes created by misc class drivers using misc_register.

Again, which misc driver wants to do this?

yes, misc driver in our system(tizen) want to use this feature. I think this will be useful for other systems also which do not have udev like user space helpers

Quoted 4 lines

thanks,

greg k-h

#3 lore raw
Quoted 11 lines · Namjae Jeon
Quoted 8 lines · Namjae Jeon
Quoted 5 lines

Add support for setting security labels on devtmpfs nodes created by misc class drivers using misc_register.

Again, which misc driver wants to do this?

yes, misc driver in our system(tizen) want to use this feature. I think this will be useful for other systems also which do not have udev like user space helpers

I don't see that driver merged so I can't accept this, sorry.

greg k-h