Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2472281imm; Mon, 24 Sep 2018 05:06:00 -0700 (PDT) X-Google-Smtp-Source: ANB0VdawZY0byaCKvfyO4o4z8MM+WlRljZXXoClr2tyvcZPhwfy9ULKqLnPf/V++WW95ZNiaSFuL X-Received: by 2002:aa7:84c2:: with SMTP id x2-v6mr10199721pfn.220.1537790760266; Mon, 24 Sep 2018 05:06:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537790760; cv=none; d=google.com; s=arc-20160816; b=JL8c230b/3/qd81Av/BnALBkJUp3DAouKXsfRQZ0MSI3GlIMef0KMf+Z9B3t6GAMK2 6FLMdg00Rlt5fW3dpJKHuGog5UXaF3PVgHDT4HEtpnLTioni4O5AYiEmiyjUna/vrzJD dmZ1NKt3KwBR2gmWeT9rPP3wER74t1EL4n2Dgbfx2EcNC1ynTbSuIr2oPrCvu6nWy3xt tLk8zGYThDV4XjHhj5Hahim/8u757wxDLwHizBeMJHlva9xqu3dcW0W+Imx+gunCEkBA Arfxl/kr5XAi7dqfGnzAo7cxqKZtS57cmYbMbTTClR/FKXMzb4yDVa389ZnFz2sUHqqh XM8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=Q+OgcyTzhnLZhrw7nzbHtKGAGRZCtTiKFIbVtZO3acY=; b=wLG2vA8Mc9BM6O+vQxAM0Xn/2z6uwDMMVv+vu4qXflOa+wRjEnBYIO3zbUMPsXaICM PSePCElZ83yHuCUky5FEBjMZPEuvrQdgShoN+l3Ftj8I/rlKJ3Lvo+m65SAriI1UKRyG UpEA9taaT3ov/tkzdOPWnaUEwRidwqc/6Lz6OM8Swb8kwBjW3esQ81SPIRmVZD82iWaS aEmL9tLwf0MSA3abZMEhhXjTkr5tugAHdU4ayZ9Axz4BxThjrYnBX5Stc+EKZg2+F3E3 4GzaENAV1WGF1sO5T4BZTs58S4HOZnmAspew2yO+U3VrMEQgQQEE0hao/0txZF1J/jLN +WdA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y40-v6si33486990pla.229.2018.09.24.05.05.44; Mon, 24 Sep 2018 05:06:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730912AbeIXSGe (ORCPT + 99 others); Mon, 24 Sep 2018 14:06:34 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:53850 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728702AbeIXSGe (ORCPT ); Mon, 24 Sep 2018 14:06:34 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 88020107A; Mon, 24 Sep 2018 12:04:46 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jia-Ju Bai Subject: [PATCH 4.9 067/111] usb: cdc-wdm: Fix a sleep-in-atomic-context bug in service_outstanding_interrupt() Date: Mon, 24 Sep 2018 13:52:34 +0200 Message-Id: <20180924113111.668558851@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113103.337261320@linuxfoundation.org> References: <20180924113103.337261320@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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: Jia-Ju Bai commit 6e22e3af7bb3a7b9dc53cb4687659f6e63fca427 upstream. wdm_in_callback() is a completion handler function for the USB driver. So it should not sleep. But it calls service_outstanding_interrupt(), which calls usb_submit_urb() with GFP_KERNEL. To fix this bug, GFP_KERNEL is replaced with GFP_ATOMIC. This bug is found by my static analysis tool DSAC. Signed-off-by: Jia-Ju Bai Cc: stable Signed-off-by: Greg Kroah-Hartman --- drivers/usb/class/cdc-wdm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c @@ -470,7 +470,7 @@ static int service_outstanding_interrupt set_bit(WDM_RESPONDING, &desc->flags); spin_unlock_irq(&desc->iuspin); - rv = usb_submit_urb(desc->response, GFP_KERNEL); + rv = usb_submit_urb(desc->response, GFP_ATOMIC); spin_lock_irq(&desc->iuspin); if (rv) { dev_err(&desc->intf->dev,