From patchwork Mon Oct 31 17:52:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Young X-Patchwork-Id: 9406155 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 22A5A60721 for ; Mon, 31 Oct 2016 17:52:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 196EB28D3E for ; Mon, 31 Oct 2016 17:52:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E50A2934E; Mon, 31 Oct 2016 17:52:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD51128D3E for ; Mon, 31 Oct 2016 17:52:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S945235AbcJaRwd (ORCPT ); Mon, 31 Oct 2016 13:52:33 -0400 Received: from gofer.mess.org ([80.229.237.210]:48081 "EHLO gofer.mess.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S945225AbcJaRwc (ORCPT ); Mon, 31 Oct 2016 13:52:32 -0400 Received: by gofer.mess.org (Postfix, from userid 1000) id 0137D60C8E; Mon, 31 Oct 2016 17:52:28 +0000 (GMT) From: Sean Young To: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org Subject: [PATCH 7/9] [media] lirc: might sleep error in lirc_dev_fop_read Date: Mon, 31 Oct 2016 17:52:25 +0000 Message-Id: <1477936347-9029-8-git-send-email-sean@mess.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1477936347-9029-1-git-send-email-sean@mess.org> References: <1477936347-9029-1-git-send-email-sean@mess.org> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP [ 101.457944] ------------[ cut here ]------------ [ 101.457954] WARNING: CPU: 3 PID: 1819 at kernel/sched/core.c:7708 __might_sleep+0x7e/0x80 [ 101.457960] do not call blocking ops when !TASK_RUNNING; state=1 set at [] lirc_dev_fop_read+0x292/0x4e0 [lirc_dev] Signed-off-by: Sean Young --- drivers/media/rc/lirc_dev.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c index 91f9bb8..bf4309f 100644 --- a/drivers/media/rc/lirc_dev.c +++ b/drivers/media/rc/lirc_dev.c @@ -684,7 +684,6 @@ ssize_t lirc_dev_fop_read(struct file *file, * between while condition checking and scheduling) */ add_wait_queue(&ir->buf->wait_poll, &wait); - set_current_state(TASK_INTERRUPTIBLE); /* * while we didn't provide 'length' bytes, device is opened in blocking @@ -709,13 +708,13 @@ ssize_t lirc_dev_fop_read(struct file *file, } mutex_unlock(&ir->irctl_lock); - schedule(); set_current_state(TASK_INTERRUPTIBLE); + schedule(); + set_current_state(TASK_RUNNING); if (mutex_lock_interruptible(&ir->irctl_lock)) { ret = -ERESTARTSYS; remove_wait_queue(&ir->buf->wait_poll, &wait); - set_current_state(TASK_RUNNING); goto out_unlocked; } @@ -735,7 +734,6 @@ ssize_t lirc_dev_fop_read(struct file *file, } remove_wait_queue(&ir->buf->wait_poll, &wait); - set_current_state(TASK_RUNNING); out_locked: mutex_unlock(&ir->irctl_lock);