diff options
| author | David Sterba <dsterba@suse.com> | 2016-02-26 15:38:32 +0100 |
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2016-02-26 15:38:32 +0100 |
| commit | 675d276b322b45e7bf7c616a2847bdc425745b99 (patch) | |
| tree | c61e7108034bf1230024880ec8ae46a9617077c2 /lib/vsprintf.c | |
| parent | e9ddd77a31e6ba2867b9c33547f6f079d55f7a72 (diff) | |
| parent | 73beece9ca07c003e0e4f4825b12be167334d4ad (diff) | |
| download | blackbird-op-linux-675d276b322b45e7bf7c616a2847bdc425745b99.tar.gz blackbird-op-linux-675d276b322b45e7bf7c616a2847bdc425745b99.zip | |
Merge branch 'foreign/liubo/replace-lockup' into for-chris-4.6
Diffstat (limited to 'lib/vsprintf.c')
| -rw-r--r-- | lib/vsprintf.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 48ff9c36644d..f44e178e6ede 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -1590,22 +1590,23 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, return buf; } case 'K': - /* - * %pK cannot be used in IRQ context because its test - * for CAP_SYSLOG would be meaningless. - */ - if (kptr_restrict && (in_irq() || in_serving_softirq() || - in_nmi())) { - if (spec.field_width == -1) - spec.field_width = default_width; - return string(buf, end, "pK-error", spec); - } - switch (kptr_restrict) { case 0: /* Always print %pK values */ break; case 1: { + const struct cred *cred; + + /* + * kptr_restrict==1 cannot be used in IRQ context + * because its test for CAP_SYSLOG would be meaningless. + */ + if (in_irq() || in_serving_softirq() || in_nmi()) { + if (spec.field_width == -1) + spec.field_width = default_width; + return string(buf, end, "pK-error", spec); + } + /* * Only print the real pointer value if the current * process has CAP_SYSLOG and is running with the @@ -1615,8 +1616,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, * leak pointer values if a binary opens a file using * %pK and then elevates privileges before reading it. */ - const struct cred *cred = current_cred(); - + cred = current_cred(); if (!has_capability_noaudit(current, CAP_SYSLOG) || !uid_eq(cred->euid, cred->uid) || !gid_eq(cred->egid, cred->gid)) |

