From: Namjae Jeon <namjae.jeon@samsung.com>
To: "'Greg Kroah-Hartman'" <gregkh@linuxfoundation.org>
Cc: "'Kay Sievers'" <kay@vrfy.org>, linux-kernel@vger.kernel.org
Subject: [PATCH 3/3] driver: core: add security labels to misc class devnode
Date: Fri, 05 Jun 2015 19:10:24 +0900 [thread overview]
Message-ID: <00ed01d09f77$d6f1f490$84d5ddb0$@samsung.com> (raw)
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
next reply other threads:[~2015-06-05 10:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-05 10:10 Namjae Jeon [this message]
2015-06-05 10:20 ` [PATCH 3/3] driver: core: add security labels to misc class devnode 'Greg Kroah-Hartman'
2015-06-05 11:16 ` Namjae Jeon
2015-06-05 11:50 ` 'Greg Kroah-Hartman'
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='00ed01d09f77$d6f1f490$84d5ddb0$@samsung.com' \
--to=namjae.jeon@samsung.com \
--cc=gregkh@linuxfoundation.org \
--cc=kay@vrfy.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.