From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by befuddled.reisers.ca (Postfix, from userid 65534) id EEA491EFD92; Mon, 5 Sep 2016 17:55:49 -0400 (EDT) Received: from hera.aquilenet.fr (hera.aquilenet.fr [IPv6:2a01:474::1]) by befuddled.reisers.ca (Postfix) with ESMTP id 2D0911EFD89 for ; Mon, 5 Sep 2016 17:55:46 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id F339984BF; Mon, 5 Sep 2016 23:55:43 +0200 (CEST) Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KcYKnDr3QCba; Mon, 5 Sep 2016 23:55:43 +0200 (CEST) Received: from var.youpi.perso.aquilenet.fr (unknown [IPv6:2a01:cb19:1af:4600:3602:86ff:fe2c:6a19]) by hera.aquilenet.fr (Postfix) with ESMTPSA id C3B998E7; Mon, 5 Sep 2016 23:55:43 +0200 (CEST) Received: from samy by var.youpi.perso.aquilenet.fr with local (Exim 4.87) (envelope-from ) id 1bh1rj-0001Ka-3i; Mon, 05 Sep 2016 23:55:43 +0200 Date: Mon, 5 Sep 2016 23:55:43 +0200 From: Samuel Thibault To: Pavel Andrianov Cc: William Hubbs , Chris Brannon , Kirk Reiser , Greg Kroah-Hartman , Shraddha Barke , Dilek Uzulmez , speakup@linux-speakup.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, vaishali.thakkar@oracle.com, ldv-project@linuxtesting.org Subject: Re: [PATCH] speakup: Add spinlock in synth_direct_store Message-ID: <20160905215543.GO4779@var.home> Mail-Followup-To: Samuel Thibault , Pavel Andrianov , William Hubbs , Chris Brannon , Kirk Reiser , Greg Kroah-Hartman , Shraddha Barke , Dilek Uzulmez , speakup@linux-speakup.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, vaishali.thakkar@oracle.com, ldv-project@linuxtesting.org References: <1473081467-1892-1-git-send-email-andrianov@ispras.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1473081467-1892-1-git-send-email-andrianov@ispras.ru> User-Agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 X-BeenThere: speakup@linux-speakup.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Speakup is a screen review system for Linux." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Sep 2016 21:55:50 -0000 Pavel Andrianov, on Mon 05 Sep 2016 16:17:47 +0300, wrote: > 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 Reviewed-by: Samuel Thibault > --- > drivers/staging/speakup/kobjects.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c > index 528cbdc..7fedee3 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; > } > > -- > 2.7.4 > -- Samuel Linux, c'est simple : ça s'adresse à une machine qui est parfois un peu maraboutée mais qui d'habitude n'a pas d'états d'âme. Sur Usenet y'a plein d'humains et de primates, et ça devient vraiment gore par moment. -+- TP in : Guide du linuxien pervers - "Le linuxien a-t-il une âme ?" -+-