From patchwork Tue Jan 18 23:09:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herton Ronaldo Krzesinski X-Patchwork-Id: 487761 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0IN8LXV032036 for ; Tue, 18 Jan 2011 23:08:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752040Ab1ARXIV (ORCPT ); Tue, 18 Jan 2011 18:08:21 -0500 Received: from perninha.conectiva.com.br ([187.115.55.249]:41696 "EHLO perninha.conectiva.com.br" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751992Ab1ARXIU (ORCPT ); Tue, 18 Jan 2011 18:08:20 -0500 Received: from localhost (perninha.conectiva.com.br [127.0.0.1]) by perninha.conectiva.com.br (Postfix) with ESMTP id 3ECDF16747; Tue, 18 Jan 2011 21:08:03 -0200 (BRST) X-Virus-Scanned: amavisd-new at conectiva.com.br Received: from perninha.conectiva.com.br ([127.0.0.1]) by localhost (perninha.conectiva.com.br [127.0.0.1]) (amavisd-new, port 10025) with LMTP id Q9a7UfW5VkFb; Tue, 18 Jan 2011 21:08:02 -0200 (BRST) Received: from fox.conectiva (firewall.conectiva [187.115.55.253]) by perninha.conectiva.com.br (Postfix) with ESMTP id 0C93E16745; Tue, 18 Jan 2011 21:08:02 -0200 (BRST) Received: from gotham.conectiva (gotham.conectiva [10.0.2.23]) by fox.conectiva (Postfix) with ESMTP id C241E2F083; Tue, 18 Jan 2011 21:08:38 -0200 (BRST) From: Herton Ronaldo Krzesinski To: linux-fbdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Herton Ronaldo Krzesinski Subject: [PATCH 2/2] fb: avoid possible deadlock caused by fb_set_suspend Date: Tue, 18 Jan 2011 21:09:59 -0200 Message-Id: <1295392199-31264-2-git-send-email-herton@mandriva.com.br> X-Mailer: git-send-email 1.7.3.5 In-Reply-To: <1295392199-31264-1-git-send-email-herton@mandriva.com.br> References: <1295392199-31264-1-git-send-email-herton@mandriva.com.br> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 18 Jan 2011 23:08:22 +0000 (UTC) diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 05d09ac..6747e06 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c @@ -1741,8 +1741,7 @@ void fb_set_suspend(struct fb_info *info, int state) { struct fb_event event; - if (!lock_fb_info(info)) - return; + WARN_ON(info->state == FBINFO_STATE_EXITING); event.info = info; if (state) { fb_notifier_call_chain(FB_EVENT_SUSPEND, &event); @@ -1751,7 +1750,6 @@ void fb_set_suspend(struct fb_info *info, int state) info->state = FBINFO_STATE_RUNNING; fb_notifier_call_chain(FB_EVENT_RESUME, &event); } - unlock_fb_info(info); } /** diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c index be361b5..2ba5370 100644 --- a/drivers/video/fbsysfs.c +++ b/drivers/video/fbsysfs.c @@ -401,9 +401,12 @@ static ssize_t store_fbstate(struct device *device, if (state && state > 1) return -EINVAL; + if (!lock_fb_info(fb_info)) + return -ENODEV; acquire_console_sem(); fb_set_suspend(fb_info, (int)state); release_console_sem(); + unlock_fb_info(fb_info); return count; }