diff options
| -rw-r--r-- | drivers/char/tpm/tpm.c | 18 | ||||
| -rw-r--r-- | drivers/char/tpm/tpm.h | 2 | ||||
| -rw-r--r-- | drivers/char/tpm/tpm_tis.c | 4 | ||||
| -rw-r--r-- | drivers/pci/pci-sysfs.c | 3 | ||||
| -rw-r--r-- | include/linux/security.h | 6 | ||||
| -rw-r--r-- | kernel/capability.c | 2 | ||||
| -rw-r--r-- | security/security.c | 5 |
7 files changed, 29 insertions, 11 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index 36e0fa161c2b..faf5a2c65926 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
| @@ -577,9 +577,11 @@ duration: | |||
| 577 | if (rc) | 577 | if (rc) |
| 578 | return; | 578 | return; |
| 579 | 579 | ||
| 580 | if (be32_to_cpu(tpm_cmd.header.out.return_code) | 580 | if (be32_to_cpu(tpm_cmd.header.out.return_code) != 0 || |
| 581 | != 3 * sizeof(u32)) | 581 | be32_to_cpu(tpm_cmd.header.out.length) |
| 582 | != sizeof(tpm_cmd.header.out) + sizeof(u32) + 3 * sizeof(u32)) | ||
| 582 | return; | 583 | return; |
| 584 | |||
| 583 | duration_cap = &tpm_cmd.params.getcap_out.cap.duration; | 585 | duration_cap = &tpm_cmd.params.getcap_out.cap.duration; |
| 584 | chip->vendor.duration[TPM_SHORT] = | 586 | chip->vendor.duration[TPM_SHORT] = |
| 585 | usecs_to_jiffies(be32_to_cpu(duration_cap->tpm_short)); | 587 | usecs_to_jiffies(be32_to_cpu(duration_cap->tpm_short)); |
| @@ -939,6 +941,18 @@ ssize_t tpm_show_caps_1_2(struct device * dev, | |||
| 939 | } | 941 | } |
| 940 | EXPORT_SYMBOL_GPL(tpm_show_caps_1_2); | 942 | EXPORT_SYMBOL_GPL(tpm_show_caps_1_2); |
| 941 | 943 | ||
| 944 | ssize_t tpm_show_timeouts(struct device *dev, struct device_attribute *attr, | ||
| 945 | char *buf) | ||
| 946 | { | ||
| 947 | struct tpm_chip *chip = dev_get_drvdata(dev); | ||
| 948 | |||
| 949 | return sprintf(buf, "%d %d %d\n", | ||
| 950 | jiffies_to_usecs(chip->vendor.duration[TPM_SHORT]), | ||
| 951 | jiffies_to_usecs(chip->vendor.duration[TPM_MEDIUM]), | ||
| 952 | jiffies_to_usecs(chip->vendor.duration[TPM_LONG])); | ||
| 953 | } | ||
| 954 | EXPORT_SYMBOL_GPL(tpm_show_timeouts); | ||
| 955 | |||
| 942 | ssize_t tpm_store_cancel(struct device *dev, struct device_attribute *attr, | 956 | ssize_t tpm_store_cancel(struct device *dev, struct device_attribute *attr, |
| 943 | const char *buf, size_t count) | 957 | const char *buf, size_t count) |
| 944 | { | 958 | { |
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index 72ddb031b69a..d84ff772c26f 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h | |||
| @@ -56,6 +56,8 @@ extern ssize_t tpm_show_owned(struct device *, struct device_attribute *attr, | |||
| 56 | char *); | 56 | char *); |
| 57 | extern ssize_t tpm_show_temp_deactivated(struct device *, | 57 | extern ssize_t tpm_show_temp_deactivated(struct device *, |
| 58 | struct device_attribute *attr, char *); | 58 | struct device_attribute *attr, char *); |
| 59 | extern ssize_t tpm_show_timeouts(struct device *, | ||
| 60 | struct device_attribute *attr, char *); | ||
| 59 | 61 | ||
| 60 | struct tpm_chip; | 62 | struct tpm_chip; |
| 61 | 63 | ||
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index dd21df55689d..0d1d38e5f266 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c | |||
| @@ -376,6 +376,7 @@ static DEVICE_ATTR(temp_deactivated, S_IRUGO, tpm_show_temp_deactivated, | |||
| 376 | NULL); | 376 | NULL); |
| 377 | static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps_1_2, NULL); | 377 | static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps_1_2, NULL); |
| 378 | static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel); | 378 | static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel); |
| 379 | static DEVICE_ATTR(timeouts, S_IRUGO, tpm_show_timeouts, NULL); | ||
| 379 | 380 | ||
| 380 | static struct attribute *tis_attrs[] = { | 381 | static struct attribute *tis_attrs[] = { |
| 381 | &dev_attr_pubek.attr, | 382 | &dev_attr_pubek.attr, |
| @@ -385,7 +386,8 @@ static struct attribute *tis_attrs[] = { | |||
| 385 | &dev_attr_owned.attr, | 386 | &dev_attr_owned.attr, |
| 386 | &dev_attr_temp_deactivated.attr, | 387 | &dev_attr_temp_deactivated.attr, |
| 387 | &dev_attr_caps.attr, | 388 | &dev_attr_caps.attr, |
| 388 | &dev_attr_cancel.attr, NULL, | 389 | &dev_attr_cancel.attr, |
| 390 | &dev_attr_timeouts.attr, NULL, | ||
| 389 | }; | 391 | }; |
| 390 | 392 | ||
| 391 | static struct attribute_group tis_attr_grp = { | 393 | static struct attribute_group tis_attr_grp = { |
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 8ecaac983923..f7771f336b7d 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
| 24 | #include <linux/fs.h> | 24 | #include <linux/fs.h> |
| 25 | #include <linux/capability.h> | 25 | #include <linux/capability.h> |
| 26 | #include <linux/security.h> | ||
| 26 | #include <linux/pci-aspm.h> | 27 | #include <linux/pci-aspm.h> |
| 27 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
| 28 | #include "pci.h" | 29 | #include "pci.h" |
| @@ -368,7 +369,7 @@ pci_read_config(struct file *filp, struct kobject *kobj, | |||
| 368 | u8 *data = (u8*) buf; | 369 | u8 *data = (u8*) buf; |
| 369 | 370 | ||
| 370 | /* Several chips lock up trying to read undefined config space */ | 371 | /* Several chips lock up trying to read undefined config space */ |
| 371 | if (cap_raised(filp->f_cred->cap_effective, CAP_SYS_ADMIN)) { | 372 | if (security_capable(filp->f_cred, CAP_SYS_ADMIN)) { |
| 372 | size = dev->cfg_size; | 373 | size = dev->cfg_size; |
| 373 | } else if (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) { | 374 | } else if (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) { |
| 374 | size = 128; | 375 | size = 128; |
diff --git a/include/linux/security.h b/include/linux/security.h index c642bb8b8f5a..b2b7f9749f5e 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
| @@ -1662,7 +1662,7 @@ int security_capset(struct cred *new, const struct cred *old, | |||
| 1662 | const kernel_cap_t *effective, | 1662 | const kernel_cap_t *effective, |
| 1663 | const kernel_cap_t *inheritable, | 1663 | const kernel_cap_t *inheritable, |
| 1664 | const kernel_cap_t *permitted); | 1664 | const kernel_cap_t *permitted); |
| 1665 | int security_capable(int cap); | 1665 | int security_capable(const struct cred *cred, int cap); |
| 1666 | int security_real_capable(struct task_struct *tsk, int cap); | 1666 | int security_real_capable(struct task_struct *tsk, int cap); |
| 1667 | int security_real_capable_noaudit(struct task_struct *tsk, int cap); | 1667 | int security_real_capable_noaudit(struct task_struct *tsk, int cap); |
| 1668 | int security_sysctl(struct ctl_table *table, int op); | 1668 | int security_sysctl(struct ctl_table *table, int op); |
| @@ -1856,9 +1856,9 @@ static inline int security_capset(struct cred *new, | |||
| 1856 | return cap_capset(new, old, effective, inheritable, permitted); | 1856 | return cap_capset(new, old, effective, inheritable, permitted); |
| 1857 | } | 1857 | } |
| 1858 | 1858 | ||
| 1859 | static inline int security_capable(int cap) | 1859 | static inline int security_capable(const struct cred *cred, int cap) |
| 1860 | { | 1860 | { |
| 1861 | return cap_capable(current, current_cred(), cap, SECURITY_CAP_AUDIT); | 1861 | return cap_capable(current, cred, cap, SECURITY_CAP_AUDIT); |
| 1862 | } | 1862 | } |
| 1863 | 1863 | ||
| 1864 | static inline int security_real_capable(struct task_struct *tsk, int cap) | 1864 | static inline int security_real_capable(struct task_struct *tsk, int cap) |
diff --git a/kernel/capability.c b/kernel/capability.c index 2f05303715a5..9e9385f132c8 100644 --- a/kernel/capability.c +++ b/kernel/capability.c | |||
| @@ -306,7 +306,7 @@ int capable(int cap) | |||
| 306 | BUG(); | 306 | BUG(); |
| 307 | } | 307 | } |
| 308 | 308 | ||
| 309 | if (security_capable(cap) == 0) { | 309 | if (security_capable(current_cred(), cap) == 0) { |
| 310 | current->flags |= PF_SUPERPRIV; | 310 | current->flags |= PF_SUPERPRIV; |
| 311 | return 1; | 311 | return 1; |
| 312 | } | 312 | } |
diff --git a/security/security.c b/security/security.c index 739e40362f44..7b7308ace8c5 100644 --- a/security/security.c +++ b/security/security.c | |||
| @@ -154,10 +154,9 @@ int security_capset(struct cred *new, const struct cred *old, | |||
| 154 | effective, inheritable, permitted); | 154 | effective, inheritable, permitted); |
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | int security_capable(int cap) | 157 | int security_capable(const struct cred *cred, int cap) |
| 158 | { | 158 | { |
| 159 | return security_ops->capable(current, current_cred(), cap, | 159 | return security_ops->capable(current, cred, cap, SECURITY_CAP_AUDIT); |
| 160 | SECURITY_CAP_AUDIT); | ||
| 161 | } | 160 | } |
| 162 | 161 | ||
| 163 | int security_real_capable(struct task_struct *tsk, int cap) | 162 | int security_real_capable(struct task_struct *tsk, int cap) |
