Merge branch 'drm-patches' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied...
[powerpc.git] / security / keys / proc.c
index c55cf1f..686a9ee 100644 (file)
@@ -137,6 +137,13 @@ static int proc_keys_show(struct seq_file *m, void *v)
        struct timespec now;
        unsigned long timo;
        char xbuf[12];
+       int rc;
+
+       /* check whether the current task is allowed to view the key (assuming
+        * non-possession) */
+       rc = key_task_permission(make_key_ref(key, 0), current, KEY_VIEW);
+       if (rc < 0)
+               return 0;
 
        now = current_kernel_time();
 
@@ -167,7 +174,7 @@ static int proc_keys_show(struct seq_file *m, void *v)
 #define showflag(KEY, LETTER, FLAG) \
        (test_bit(FLAG, &(KEY)->flags) ? LETTER : '-')
 
-       seq_printf(m, "%08x %c%c%c%c%c%c %5d %4s %06x %5d %5d %-9.9s ",
+       seq_printf(m, "%08x %c%c%c%c%c%c %5d %4s %08x %5d %5d %-9.9s ",
                   key->serial,
                   showflag(key, 'I', KEY_FLAG_INSTANTIATED),
                   showflag(key, 'R', KEY_FLAG_REVOKED),