linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix dmesg_restrict build failure with CONFIG_EMBEDDED=y and CONFIG_PRINTK=n
@ 2010-11-13 17:26 Joe Perches
  2010-11-13 17:50 ` Linus Torvalds
  0 siblings, 1 reply; 23+ messages in thread
From: Joe Perches @ 2010-11-13 17:26 UTC (permalink / raw)
  To: Dan Rosenberg, LKML
  Cc: Ingo Molnar, Eugene Teo, Kees Cook, Andrew Morton, Linus Torvalds

dmesg_restrict is guarded by #ifdef CONFIG_PRINTK in kernel.h
Its uses need to be guarded as well.

Signed-off-by: Joe Perches <joe@perches.com>
---
 kernel/sysctl.c      |    2 +-
 security/commoncap.c |    2 ++
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index b65bf63..5abfa15 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -702,7 +702,6 @@ static struct ctl_table kern_table[] = {
 		.extra1		= &zero,
 		.extra2		= &ten_thousand,
 	},
-#endif
 	{
 		.procname	= "dmesg_restrict",
 		.data		= &dmesg_restrict,
@@ -712,6 +711,7 @@ static struct ctl_table kern_table[] = {
 		.extra1		= &zero,
 		.extra2		= &one,
 	},
+#endif
 	{
 		.procname	= "ngroups_max",
 		.data		= &ngroups_max,
diff --git a/security/commoncap.c b/security/commoncap.c
index 04b80f9..29f2368 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -895,8 +895,10 @@ int cap_syslog(int type, bool from_file)
 {
 	if (type != SYSLOG_ACTION_OPEN && from_file)
 		return 0;
+#ifdef CONFIG_PRINTK
 	if (dmesg_restrict && !capable(CAP_SYS_ADMIN))
 		return -EPERM;
+#endif
 	if ((type != SYSLOG_ACTION_READ_ALL &&
 	     type != SYSLOG_ACTION_SIZE_BUFFER) && !capable(CAP_SYS_ADMIN))
 		return -EPERM;



^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2010-11-15 23:09 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-13 17:26 [PATCH] Fix dmesg_restrict build failure with CONFIG_EMBEDDED=y and CONFIG_PRINTK=n Joe Perches
2010-11-13 17:50 ` Linus Torvalds
2010-11-13 18:25   ` Dan Rosenberg
2010-11-13 20:22     ` Linus Torvalds
2010-11-14  3:05       ` Kees Cook
2010-11-14 12:35       ` Ingo Molnar
2010-11-13 19:51   ` Joe Perches
2010-11-13 20:01     ` Joe Perches
2010-11-13 20:31     ` Linus Torvalds
2010-11-15  1:16       ` James Morris
2010-11-15 17:04       ` Eric Paris
2010-11-15 17:34         ` Eric Paris
2010-11-15 17:41           ` Linus Torvalds
2010-11-15 17:45             ` Eric Paris
2010-11-15 18:20               ` Linus Torvalds
2010-11-15 22:13               ` James Morris
2010-11-15 22:43                 ` Eric Paris
2010-11-15 22:58                   ` James Morris
2010-11-15 23:08                     ` Eric Paris
2010-11-15 22:16             ` James Morris
2010-11-15 22:36               ` Linus Torvalds
2010-11-15 22:51                 ` James Morris
2010-11-14  2:44   ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).