Skip to content

Commit 2b17e90

Browse files
committed
Merge tag 'tpmdd-v6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd
Pull tpm fixes from Jarkko Sakkinen: "I picked up three small scale updates that I think would improve the quality of the release" * tag 'tpmdd-v6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd: tpm_tis: Explicitly check for error code tpm: Switch i2c drivers back to use .probe() security: keys: perform capable check only on privileged operations
2 parents f837f0a + 513253f commit 2b17e90

File tree

8 files changed

+21
-11
lines changed

8 files changed

+21
-11
lines changed

drivers/char/tpm/st33zp24/i2c.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ static struct i2c_driver st33zp24_i2c_driver = {
160160
.of_match_table = of_match_ptr(of_st33zp24_i2c_match),
161161
.acpi_match_table = ACPI_PTR(st33zp24_i2c_acpi_match),
162162
},
163-
.probe_new = st33zp24_i2c_probe,
163+
.probe = st33zp24_i2c_probe,
164164
.remove = st33zp24_i2c_remove,
165165
.id_table = st33zp24_i2c_id
166166
};

drivers/char/tpm/tpm_i2c_atmel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ static SIMPLE_DEV_PM_OPS(i2c_atmel_pm_ops, tpm_pm_suspend, tpm_pm_resume);
203203

204204
static struct i2c_driver i2c_atmel_driver = {
205205
.id_table = i2c_atmel_id,
206-
.probe_new = i2c_atmel_probe,
206+
.probe = i2c_atmel_probe,
207207
.remove = i2c_atmel_remove,
208208
.driver = {
209209
.name = I2C_DRIVER_NAME,

drivers/char/tpm/tpm_i2c_infineon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ static void tpm_tis_i2c_remove(struct i2c_client *client)
716716

717717
static struct i2c_driver tpm_tis_i2c_driver = {
718718
.id_table = tpm_tis_i2c_table,
719-
.probe_new = tpm_tis_i2c_probe,
719+
.probe = tpm_tis_i2c_probe,
720720
.remove = tpm_tis_i2c_remove,
721721
.driver = {
722722
.name = "tpm_i2c_infineon",

drivers/char/tpm/tpm_i2c_nuvoton.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ static SIMPLE_DEV_PM_OPS(i2c_nuvoton_pm_ops, tpm_pm_suspend, tpm_pm_resume);
650650

651651
static struct i2c_driver i2c_nuvoton_driver = {
652652
.id_table = i2c_nuvoton_id,
653-
.probe_new = i2c_nuvoton_probe,
653+
.probe = i2c_nuvoton_probe,
654654
.remove = i2c_nuvoton_remove,
655655
.driver = {
656656
.name = "tpm_i2c_nuvoton",

drivers/char/tpm/tpm_tis_core.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,13 @@ static int tpm_tis_recv(struct tpm_chip *chip, u8 *buf, size_t count)
366366
goto out;
367367
}
368368

369-
size += recv_data(chip, &buf[TPM_HEADER_SIZE],
370-
expected - TPM_HEADER_SIZE);
369+
rc = recv_data(chip, &buf[TPM_HEADER_SIZE],
370+
expected - TPM_HEADER_SIZE);
371+
if (rc < 0) {
372+
size = rc;
373+
goto out;
374+
}
375+
size += rc;
371376
if (size < expected) {
372377
dev_err(&chip->dev, "Unable to read remainder of result\n");
373378
size = -ETIME;

drivers/char/tpm/tpm_tis_i2c.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ static struct i2c_driver tpm_tis_i2c_driver = {
394394
.pm = &tpm_tis_pm,
395395
.of_match_table = of_match_ptr(of_tis_i2c_match),
396396
},
397-
.probe_new = tpm_tis_i2c_probe,
397+
.probe = tpm_tis_i2c_probe,
398398
.remove = tpm_tis_i2c_remove,
399399
.id_table = tpm_tis_i2c_id,
400400
};

drivers/char/tpm/tpm_tis_i2c_cr50.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ static void tpm_cr50_i2c_remove(struct i2c_client *client)
779779
static SIMPLE_DEV_PM_OPS(cr50_i2c_pm, tpm_pm_suspend, tpm_pm_resume);
780780

781781
static struct i2c_driver cr50_i2c_driver = {
782-
.probe_new = tpm_cr50_i2c_probe,
782+
.probe = tpm_cr50_i2c_probe,
783783
.remove = tpm_cr50_i2c_remove,
784784
.driver = {
785785
.name = "cr50_i2c",

security/keys/keyctl.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -980,14 +980,19 @@ long keyctl_chown_key(key_serial_t id, uid_t user, gid_t group)
980980
ret = -EACCES;
981981
down_write(&key->sem);
982982

983-
if (!capable(CAP_SYS_ADMIN)) {
983+
{
984+
bool is_privileged_op = false;
985+
984986
/* only the sysadmin can chown a key to some other UID */
985987
if (user != (uid_t) -1 && !uid_eq(key->uid, uid))
986-
goto error_put;
988+
is_privileged_op = true;
987989

988990
/* only the sysadmin can set the key's GID to a group other
989991
* than one of those that the current process subscribes to */
990992
if (group != (gid_t) -1 && !gid_eq(gid, key->gid) && !in_group_p(gid))
993+
is_privileged_op = true;
994+
995+
if (is_privileged_op && !capable(CAP_SYS_ADMIN))
991996
goto error_put;
992997
}
993998

@@ -1088,7 +1093,7 @@ long keyctl_setperm_key(key_serial_t id, key_perm_t perm)
10881093
down_write(&key->sem);
10891094

10901095
/* if we're not the sysadmin, we can only change a key that we own */
1091-
if (capable(CAP_SYS_ADMIN) || uid_eq(key->uid, current_fsuid())) {
1096+
if (uid_eq(key->uid, current_fsuid()) || capable(CAP_SYS_ADMIN)) {
10921097
key->perm = perm;
10931098
notify_key(key, NOTIFY_KEY_SETATTR, 0);
10941099
ret = 0;

0 commit comments

Comments
 (0)