Commit 9da21b15 authored by Borislav Petkov's avatar Borislav Petkov

EDAC: Poll timeout cannot be zero, p2

Sanitize code even more to accept unsigned longs only and to not allow
polling intervals below 1 second as this is unnecessary and doesn't make
much sense anyway for polling errors.
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Link: http://lkml.kernel.org/r/1391457913-881-1-git-send-email-prarit@redhat.com
Cc: Doug Thompson <dougthompson@xmission.com>
Cc: <stable@vger.kernel.org>
parent 4675348e
...@@ -601,7 +601,7 @@ static void edac_mc_workq_teardown(struct mem_ctl_info *mci) ...@@ -601,7 +601,7 @@ static void edac_mc_workq_teardown(struct mem_ctl_info *mci)
* user space has updated our poll period value, need to * user space has updated our poll period value, need to
* reset our workq delays * reset our workq delays
*/ */
void edac_mc_reset_delay_period(int value) void edac_mc_reset_delay_period(unsigned long value)
{ {
struct mem_ctl_info *mci; struct mem_ctl_info *mci;
struct list_head *item; struct list_head *item;
...@@ -611,7 +611,7 @@ void edac_mc_reset_delay_period(int value) ...@@ -611,7 +611,7 @@ void edac_mc_reset_delay_period(int value)
list_for_each(item, &mc_devices) { list_for_each(item, &mc_devices) {
mci = list_entry(item, struct mem_ctl_info, link); mci = list_entry(item, struct mem_ctl_info, link);
edac_mc_workq_setup(mci, (unsigned long) value); edac_mc_workq_setup(mci, value);
} }
mutex_unlock(&mem_ctls_mutex); mutex_unlock(&mem_ctls_mutex);
......
...@@ -52,18 +52,20 @@ int edac_mc_get_poll_msec(void) ...@@ -52,18 +52,20 @@ int edac_mc_get_poll_msec(void)
static int edac_set_poll_msec(const char *val, struct kernel_param *kp) static int edac_set_poll_msec(const char *val, struct kernel_param *kp)
{ {
long l; unsigned long l;
int ret; int ret;
if (!val) if (!val)
return -EINVAL; return -EINVAL;
ret = kstrtol(val, 0, &l); ret = kstrtoul(val, 0, &l);
if (ret) if (ret)
return ret; return ret;
if (!l || ((int)l != l))
if (l < 1000)
return -EINVAL; return -EINVAL;
*((int *)kp->arg) = l;
*((unsigned long *)kp->arg) = l;
/* notify edac_mc engine to reset the poll period */ /* notify edac_mc engine to reset the poll period */
edac_mc_reset_delay_period(l); edac_mc_reset_delay_period(l);
......
...@@ -52,7 +52,7 @@ extern void edac_device_workq_setup(struct edac_device_ctl_info *edac_dev, ...@@ -52,7 +52,7 @@ extern void edac_device_workq_setup(struct edac_device_ctl_info *edac_dev,
extern void edac_device_workq_teardown(struct edac_device_ctl_info *edac_dev); extern void edac_device_workq_teardown(struct edac_device_ctl_info *edac_dev);
extern void edac_device_reset_delay_period(struct edac_device_ctl_info extern void edac_device_reset_delay_period(struct edac_device_ctl_info
*edac_dev, unsigned long value); *edac_dev, unsigned long value);
extern void edac_mc_reset_delay_period(int value); extern void edac_mc_reset_delay_period(unsigned long value);
extern void *edac_align_ptr(void **p, unsigned size, int n_elems); extern void *edac_align_ptr(void **p, unsigned size, int n_elems);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment