From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michal Januszewski Subject: [PATCH 2/7] uvesafb: always use mutexes when accessing uvfb_tasks Date: Sat, 11 Aug 2007 16:39:23 +0200 Message-ID: <20070811143923.GC13632@spock.one.pl> Reply-To: spock@gentoo.org, linux-fbdev-devel@lists.sourceforge.net Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from sc8-sf-mx1-b.sourceforge.net ([10.3.1.91] helo=mail.sourceforge.net) by sc8-sf-list1-new.sourceforge.net with esmtp (Exim 4.43) id 1IJs85-0005O0-Di for linux-fbdev-devel@lists.sourceforge.net; Sat, 11 Aug 2007 07:39:49 -0700 Received: from ipn26-148.piekary.net ([83.238.26.148] helo=spock.one.pl) by mail.sourceforge.net with esmtp (Exim 4.44) id 1IJs84-0003KT-1L for linux-fbdev-devel@lists.sourceforge.net; Sat, 11 Aug 2007 07:39:49 -0700 Content-Disposition: inline List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-fbdev-devel-bounces@lists.sourceforge.net Errors-To: linux-fbdev-devel-bounces@lists.sourceforge.net To: linux-fbdev-devel@lists.sourceforge.net Cc: linux-kernel@vger.kernel.org Accesses to the uvfb_tasks array should be always be protected by a mutex to avoid race conditions. Signed-off-by: Michal Januszewski --- diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c index aa5a9c3..e480670 100644 --- a/drivers/video/uvesafb.c +++ b/drivers/video/uvesafb.c @@ -208,6 +208,10 @@ static int uvesafb_exec(struct uvesafb_ktask *task) err = !wait_for_completion_timeout(task->done, msecs_to_jiffies(UVESAFB_TIMEOUT)); + mutex_lock(&uvfb_lock); + uvfb_tasks[seq] = NULL; + mutex_unlock(&uvfb_lock); + seq++; if (seq >= UVESAFB_TASKS_MAX) seq = 0; ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761062AbXHKOjz (ORCPT ); Sat, 11 Aug 2007 10:39:55 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754704AbXHKOjr (ORCPT ); Sat, 11 Aug 2007 10:39:47 -0400 Received: from ipn26-148.piekary.net ([83.238.26.148]:52089 "EHLO spock.one.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754805AbXHKOjr (ORCPT ); Sat, 11 Aug 2007 10:39:47 -0400 Date: Sat, 11 Aug 2007 16:39:23 +0200 From: Michal Januszewski To: linux-fbdev-devel@lists.sourceforge.net Cc: linux-kernel@vger.kernel.org Subject: [PATCH 2/7] uvesafb: always use mutexes when accessing uvfb_tasks Message-ID: <20070811143923.GC13632@spock.one.pl> Reply-To: spock@gentoo.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Disposition: inline X-PGP-Key: http://dev.gentoo.org/~spock/spock.gpg User-Agent: Mutt/1.5.16 (2007-06-09) Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Accesses to the uvfb_tasks array should be always be protected by a mutex to avoid race conditions. Signed-off-by: Michal Januszewski --- diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c index aa5a9c3..e480670 100644 --- a/drivers/video/uvesafb.c +++ b/drivers/video/uvesafb.c @@ -208,6 +208,10 @@ static int uvesafb_exec(struct uvesafb_ktask *task) err = !wait_for_completion_timeout(task->done, msecs_to_jiffies(UVESAFB_TIMEOUT)); + mutex_lock(&uvfb_lock); + uvfb_tasks[seq] = NULL; + mutex_unlock(&uvfb_lock); + seq++; if (seq >= UVESAFB_TASKS_MAX) seq = 0;