dgnc_driver_pollrate_store needs to take a lock before modifying the shared variable dgnc_poll_tick. Signed-off-by: Salah Triki <salah.triki@xxxxxxx> --- drivers/staging/dgnc/dgnc_sysfs.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/staging/dgnc/dgnc_sysfs.c b/drivers/staging/dgnc/dgnc_sysfs.c index 44db870..204ae05 100644 --- a/drivers/staging/dgnc/dgnc_sysfs.c +++ b/drivers/staging/dgnc/dgnc_sysfs.c @@ -57,10 +57,20 @@ static ssize_t dgnc_driver_pollrate_store(struct device_driver *ddp, const char *buf, size_t count) { int ret; + int tick; + static DEFINE_MUTEX(mut); - ret = sscanf(buf, "%d\n", &dgnc_poll_tick); + ret = sscanf(buf, "%d\n", &tick); if (ret != 1) return -EINVAL; + + ret = mutex_lock_interruptible(&mut); + if (ret) + return -ERESTARTSYS; + + dgnc_poll_tick = tick; + + mutex_unlock(&mut); return count; } static DRIVER_ATTR(pollrate, (S_IRUSR | S_IWUSR), dgnc_driver_pollrate_show, -- 1.9.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel