From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E3FDC169C4 for ; Tue, 29 Jan 2019 11:58:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E1FCF20882 for ; Tue, 29 Jan 2019 11:58:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548763084; bh=fhPcsEUfGecLET/asQ7AeBkxh/R4C06ks1XmPZiox/k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=JkARjrXYixS5ob0IVUsMo/2sLUVvIdrzmnbfEXT2Wv4ehim+c987NfxB0uVpJ9i0K HF4qLKa6a3r9E/fuRZdJLRbffRy0phv+8SZSbuqTUYRv7pUGHpa3PWVSxDuP7u6YIc raSTA8EJvykKSYB+C+Kt/UyvdKYSlcHcoUmeX040= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731330AbfA2Ls3 (ORCPT ); Tue, 29 Jan 2019 06:48:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:39296 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730689AbfA2LsY (ORCPT ); Tue, 29 Jan 2019 06:48:24 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 98E522086C; Tue, 29 Jan 2019 11:48:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548762504; bh=fhPcsEUfGecLET/asQ7AeBkxh/R4C06ks1XmPZiox/k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F+4ojLzttKBnmqAFLwh7RaZrnG0lpcllsN2+axw3n08Cd6n2YG1CSdk9eBplIUyyz SBSLr+9UbCksHsmyAhnofJNreLJMidivAk8b6yoLlFp9dSpLcxwgeHpJTLbC9wY3gR vrj+fqv08qxgEJFDI+U7A1Gt/f/rc9cvEm21y4Iw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Fulghum , syzbot , Tetsuo Handa , Alan Cox , Arnd Bergmann Subject: [PATCH 4.14 27/68] tty/n_hdlc: fix __might_sleep warning Date: Tue, 29 Jan 2019 12:35:49 +0100 Message-Id: <20190129113133.870908913@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190129113131.751891514@linuxfoundation.org> References: <20190129113131.751891514@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Paul Fulghum commit fc01d8c61ce02c034e67378cd3e645734bc18c8c upstream. Fix __might_sleep warning[1] in tty/n_hdlc.c read due to copy_to_user call while current is TASK_INTERRUPTIBLE. This is a false positive since the code path does not depend on current state remaining TASK_INTERRUPTIBLE. The loop breaks out and sets TASK_RUNNING after calling copy_to_user. This patch supresses the warning by setting TASK_RUNNING before calling copy_to_user. [1] https://syzkaller.appspot.com/bug?id=17d5de7f1fcab794cb8c40032f893f52de899324 Signed-off-by: Paul Fulghum Reported-by: syzbot Cc: Tetsuo Handa Cc: Alan Cox Cc: stable Acked-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/tty/n_hdlc.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/tty/n_hdlc.c +++ b/drivers/tty/n_hdlc.c @@ -598,6 +598,7 @@ static ssize_t n_hdlc_tty_read(struct tt /* too large for caller's buffer */ ret = -EOVERFLOW; } else { + __set_current_state(TASK_RUNNING); if (copy_to_user(buf, rbuf->buf, rbuf->count)) ret = -EFAULT; else