Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2333617ybz; Thu, 23 Apr 2020 16:12:49 -0700 (PDT) X-Google-Smtp-Source: APiQypJdXKVDrL4xdAzdthmU7h0VBBG9j4h3g4/egcLgE6Pn7koToHSfWSgcC4A5OhJ6cWvvQOzL X-Received: by 2002:a17:907:2155:: with SMTP id rk21mr4896896ejb.163.1587683569138; Thu, 23 Apr 2020 16:12:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587683569; cv=none; d=google.com; s=arc-20160816; b=kfRN5rNIEIdDeCJ83v14jZUrskToKL/VT3Bz/077Zu2Tp2581wZLcZCfAZmuEDWiEP a1m5NcqdVrvgYolKgfA7pNZKjxheCVE9XU8ZkCHKhn1J3pTzd+H4RpoQ0l/JPO4udZc4 8C1hrc5kI+cEcSmnXokZAbB7+IyVG1Jcqm8TkJfvlKctWBo5Ip5hAt/HXmkAk6ElCpa0 ZoOcprc01A7KQsl1hqvQ98V6GVec78YFkcDnj5rRbPI5XQnkBAVV28HmRT6wGDCnClfR V4WRRCvVuzG/eEVsmeK8aJIJm4o9Dy6l1ibezs9mkvoydTU0paOazjbxjHBXnja3lxC7 j6MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=uS8aQMv1O5WYpF98KiNXXGoapjpt7UBsmG0dTrDOAkM=; b=aCVXVlLR1u/7tVpM2j2lgpgf7qqUbnQtOS7A2bC+NAp1da4S+LzqPQEe36+vunb9IS zl011++WkkEHgWaEBAnBPuKuDrAxGoXQP8UVWnriJApkMFjKeg/cqU7c24IJBS9tgo1G qemhmV+nKOjPEt1UZDPDQUpgbTaLJDU+Wfi7r5vqjfVChAmWYXlH1bQqSwB3UngskHuQ 7AtB1DD1cCFzvH/p+E7rFu7UtdbmZd/jLWbisF82ILcCciivcys4NJSVZSJloiNvCXCx tA9MEuhWrxnBcAIWJ492uMvj8st2UqX76fQ1adkWz7c8f+zzyu8k7dsPu5RuKkjM5r0W IeHQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i2si2029201edn.210.2020.04.23.16.12.25; Thu, 23 Apr 2020 16:12:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728421AbgDWXJ4 (ORCPT + 99 others); Thu, 23 Apr 2020 19:09:56 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:50666 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728618AbgDWXGz (ORCPT ); Thu, 23 Apr 2020 19:06:55 -0400 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1jRkvh-0004up-Ua; Fri, 24 Apr 2020 00:06:50 +0100 Received: from ben by deadeye with local (Exim 4.93) (envelope-from ) id 1jRkvd-00E71n-5C; Fri, 24 Apr 2020 00:06:45 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, Denis Kirjanov , "Greg Kroah-Hartman" , "Peter Hurley" Date: Fri, 24 Apr 2020 00:07:26 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 219/245] tty: vt: Fix !TASK_RUNNING diagnostic warning from paste_selection() In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.83-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Peter Hurley commit 61e86cc90af49cecef9c54ccea1f572fbcb695ac upstream. Pasting text with gpm on a VC produced warning [1]. Reset task state to TASK_RUNNING in the paste_selection() loop, if the loop did not sleep. [1] WARNING: CPU: 6 PID: 1960 at /home/peter/src/kernels/mainline/kernel/sched/core.c:7286 __might_sleep+0x7f/0x90() do not call blocking ops when !TASK_RUNNING; state=1 set at [] paste_selection+0x9e/0x1a0 Modules linked in: btrfs xor raid6_pq ufs qnx4 hfsplus hfs minix ntfs msdos jfs xfs libcrc32c ..... CPU: 6 PID: 1960 Comm: gpm Not tainted 4.1.0-rc7+tty-xeon+debug #rc7+tty Hardware name: Dell Inc. Precision WorkStation T5400 /0RW203, BIOS A11 04/30/2012 ffffffff81c9c0a0 ffff8802b0fd3ac8 ffffffff8185778a 0000000000000001 ffff8802b0fd3b18 ffff8802b0fd3b08 ffffffff8108039a ffffffff82ae8510 ffffffff81c9ce00 0000000000000015 0000000000000000 0000000000000000 Call Trace: [] dump_stack+0x4f/0x7b [] warn_slowpath_common+0x8a/0xc0 [] warn_slowpath_fmt+0x46/0x50 [] ? __lock_acquire+0xe2d/0x13a0 [] ? paste_selection+0x9e/0x1a0 [] ? paste_selection+0x9e/0x1a0 [] __might_sleep+0x7f/0x90 [] down_read+0x2a/0xa0 [] ? sched_clock_cpu+0xb8/0xe0 [] n_tty_receive_buf_common+0x4c/0xba0 [] ? mark_held_locks+0x75/0xa0 [] ? _raw_spin_unlock_irqrestore+0x65/0x80 [] ? get_parent_ip+0x11/0x50 [] n_tty_receive_buf2+0x14/0x20 [] paste_selection+0x157/0x1a0 [] ? wake_up_state+0x20/0x20 [] tioclinux+0xb8/0x2c0 [] vt_ioctl+0xaee/0x11a0 [] ? sched_clock_local+0x25/0x90 [] ? vtime_account_user+0x91/0xa0 [] tty_ioctl+0x20c/0xe20 [] ? vtime_account_user+0x91/0xa0 [] ? get_parent_ip+0x11/0x50 [] ? preempt_count_sub+0x49/0x50 [] ? context_tracking_exit+0x5c/0x290 [] ? context_tracking_exit+0x5c/0x290 [] do_vfs_ioctl+0x318/0x570 [] ? trace_hardirqs_on+0xd/0x10 [] ? trace_hardirqs_on_caller+0x115/0x1e0 [] ? __fget_light+0x6c/0xa0 [] SyS_ioctl+0x81/0xa0 [] system_call_fastpath+0x16/0x7a Signed-off-by: Peter Hurley Signed-off-by: Greg Kroah-Hartman Signed-off-by: Ben Hutchings --- drivers/tty/vt/selection.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/tty/vt/selection.c +++ b/drivers/tty/vt/selection.c @@ -356,6 +356,7 @@ int paste_selection(struct tty_struct *t schedule(); continue; } + __set_current_state(TASK_RUNNING); count = sel_buffer_lth - pasted; count = tty_ldisc_receive_buf(ld, sel_buffer + pasted, NULL, count);