diff options
author | Pavel Andrianov <andrianov@ispras.ru> | 2016-09-05 16:17:47 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-09-12 13:13:25 +0200 |
commit | 777953182ea9a750e744bd0a50fb8893cd061397 (patch) | |
tree | fac1d69668975b2465d7e9e627811a973a925462 /drivers | |
parent | da25a8ec6b2d66d9510358173b8da4c80d686c2b (diff) | |
download | linux-777953182ea9a750e744bd0a50fb8893cd061397.tar.bz2 |
speakup: Add spinlock in synth_direct_store
All operations with synth buffer should be protected,
as there are global pointers, which should be modified atomically.
Found by Linux Driver Verification project (linuxtesting.org)
Signed-off-by: Pavel Andrianov <andrianov@ispras.ru>
Acked-by: Vaishali Thakkar <vaishali.thakkar@oracle.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/speakup/kobjects.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c index 528cbdce4227..7fedee363455 100644 --- a/drivers/staging/speakup/kobjects.c +++ b/drivers/staging/speakup/kobjects.c @@ -411,11 +411,13 @@ static ssize_t synth_direct_store(struct kobject *kobj, int len; int bytes; const char *ptr = buf; + unsigned long flags; if (!synth) return -EPERM; len = strlen(buf); + spin_lock_irqsave(&speakup_info.spinlock, flags); while (len > 0) { bytes = min_t(size_t, len, 250); strncpy(tmp, ptr, bytes); @@ -425,6 +427,7 @@ static ssize_t synth_direct_store(struct kobject *kobj, ptr += bytes; len -= bytes; } + spin_unlock_irqrestore(&speakup_info.spinlock, flags); return count; } |