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,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 48B01C282C7 for ; Tue, 29 Jan 2019 11:52:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0A8E42086C for ; Tue, 29 Jan 2019 11:52:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548762761; bh=5uCWltJzeHJBzRKUlRBoRDjKY5tqxH6ErYXO0kY1rwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=YQQmCxy0HfSZsCF+cBgXZQzKHs7DN/G40kMMnTIbLO8gtWyTeVIiKpDAeXlG7iBGH nW5i2qdsjuyvoifKSzvVVk/ylxL8pTU2jPlm5SzNQ1sob1+itaGQGQQKP82fOsuLT+ jTdeKWD56hSQe+Q9480tclKPPo2JMplf266eenJ0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732140AbfA2Lwj (ORCPT ); Tue, 29 Jan 2019 06:52:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:44444 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731038AbfA2Lwg (ORCPT ); Tue, 29 Jan 2019 06:52:36 -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 CDB992086C; Tue, 29 Jan 2019 11:52:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548762755; bh=5uCWltJzeHJBzRKUlRBoRDjKY5tqxH6ErYXO0kY1rwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0Adbj/hnKRbb7UkDqV8joteBmPy83tIVm2c2kZZfrMq2+2buphV0LVzWYlU06XABy pRvTH3gHZauZZlQHVtf4p4nqAX1R8SMdvIvj8570evW7pxXsbmGgxvT99cgNBW6oRn 9zHzCfmNoha2+6S5gvWGUssxPDwZBE231dP8oC5w= 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.9 21/44] tty/n_hdlc: fix __might_sleep warning Date: Tue, 29 Jan 2019 12:36:16 +0100 Message-Id: <20190129113141.683642152@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190129113139.826927690@linuxfoundation.org> References: <20190129113139.826927690@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.9-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