diff options
| -rw-r--r-- | security/yama/yama_lsm.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/security/yama/yama_lsm.c b/security/yama/yama_lsm.c index 13c88fbcf037..24aae2ae2b30 100644 --- a/security/yama/yama_lsm.c +++ b/security/yama/yama_lsm.c | |||
| @@ -379,20 +379,17 @@ static struct security_operations yama_ops = { | |||
| 379 | static int yama_dointvec_minmax(struct ctl_table *table, int write, | 379 | static int yama_dointvec_minmax(struct ctl_table *table, int write, |
| 380 | void __user *buffer, size_t *lenp, loff_t *ppos) | 380 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 381 | { | 381 | { |
| 382 | int rc; | 382 | struct ctl_table table_copy; |
| 383 | 383 | ||
| 384 | if (write && !capable(CAP_SYS_PTRACE)) | 384 | if (write && !capable(CAP_SYS_PTRACE)) |
| 385 | return -EPERM; | 385 | return -EPERM; |
| 386 | 386 | ||
| 387 | rc = proc_dointvec_minmax(table, write, buffer, lenp, ppos); | ||
| 388 | if (rc) | ||
| 389 | return rc; | ||
| 390 | |||
| 391 | /* Lock the max value if it ever gets set. */ | 387 | /* Lock the max value if it ever gets set. */ |
| 392 | if (write && *(int *)table->data == *(int *)table->extra2) | 388 | table_copy = *table; |
| 393 | table->extra1 = table->extra2; | 389 | if (*(int *)table_copy.data == *(int *)table_copy.extra2) |
| 390 | table_copy.extra1 = table_copy.extra2; | ||
| 394 | 391 | ||
| 395 | return rc; | 392 | return proc_dointvec_minmax(&table_copy, write, buffer, lenp, ppos); |
| 396 | } | 393 | } |
| 397 | 394 | ||
| 398 | static int zero; | 395 | static int zero; |
