diff options
author | Borislav Petkov <bp@suse.de> | 2019-04-20 21:33:08 +0200 |
---|---|---|
committer | Borislav Petkov <bp@suse.de> | 2019-06-08 17:34:36 +0200 |
commit | 5cc6b16ea1313d05956b55e83a1f753c604282a8 (patch) | |
tree | 0ea40140c969393c91d33f5379306f0cd57267e6 /drivers/ras/cec.c | |
parent | RAS/CEC: Check count_threshold unconditionally (diff) | |
download | linux-5cc6b16ea1313d05956b55e83a1f753c604282a8.tar.xz linux-5cc6b16ea1313d05956b55e83a1f753c604282a8.zip |
RAS/CEC: Do not set decay value on error
When the value requested doesn't match the allowed (min,max) range,
the @data buffer should not be modified with the invalid value because
reading "decay_interval" shows it otherwise as if the previous write
succeeded.
Move the data write after the check.
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: linux-edac <linux-edac@vger.kernel.org>
Diffstat (limited to 'drivers/ras/cec.c')
-rw-r--r-- | drivers/ras/cec.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/ras/cec.c b/drivers/ras/cec.c index 73a975c26f9f..31868bd99e8d 100644 --- a/drivers/ras/cec.c +++ b/drivers/ras/cec.c @@ -371,17 +371,17 @@ DEFINE_DEBUGFS_ATTRIBUTE(pfn_ops, u64_get, pfn_set, "0x%llx\n"); static int decay_interval_set(void *data, u64 val) { - *(u64 *)data = val; - if (val < CEC_DECAY_MIN_INTERVAL) return -EINVAL; if (val > CEC_DECAY_MAX_INTERVAL) return -EINVAL; + *(u64 *)data = val; decay_interval = val; cec_mod_work(decay_interval); + return 0; } DEFINE_DEBUGFS_ATTRIBUTE(decay_interval_ops, u64_get, decay_interval_set, "%lld\n"); |