Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2509063imm; Mon, 24 Sep 2018 05:40:10 -0700 (PDT) X-Google-Smtp-Source: ACcGV62M+wisoTQuB0+cz0LqEmEKv9EBglZnSjiAeA1+fF5IV6bLGJN+9ZYFUQSVBeZyORbMNkPB X-Received: by 2002:a17:902:e088:: with SMTP id cb8-v6mr10583176plb.189.1537792810121; Mon, 24 Sep 2018 05:40:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537792810; cv=none; d=google.com; s=arc-20160816; b=slDkZBd7W45t1jlBdWNIBXJ2qvdVAzETYY4syl96uC5J3u+CLv9ygt39VaLZxztrSq 06t2abOqKlpcIhg38QI1ZX2gaflUPB36D7Q9zRo42Epd9pGUBILgWcqeAQSV3EkYRjMi 59D3yUIg+R3FfEgtOE0tBK3267Wr7R6DPrvt9t/C+BToCUUJLiJAhwSV0WTOMmnDcz+8 n6HqwfeC3ud2ZcIdeRNnQYO6bvkE3okVyPgtBOdxC1JLPzWsELUZxcMr1CNfOP1NduxB Xci1eDAaMxJ4/Wt3MjjTQzS5DbntRAFTtLwaa0r6tA2j9jZEyH4elKUuoA41UojsBPhw tXkg== 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=ZgOBUYWpSx+mlttZvqB/J14Qr3jWevcNF4F0o1QUc8g=; b=T2bJkuHN0tRV6Eeq1BKEsxfY7XGFX74yf18Hfluvz7jG1Xnpheq/p8dARF1ceuwU+f KBukoLIGPdcxfkY4Ya+mfUaAsZxWC7+KrYqp1gvW8+ZAqny/CSG3NvlE7gk5rO/Wj7kf Ks4QkttMuV4HkHWRPTvbTp+ammZRs/J4PL6UUA3kv2gW/NmLekt6ARukLJyX0Zt/yZAy wBrw/StazqEW3t07ZeIAFMR62ZQ8FYUz/GtpfnF0vtTEv+zT32idB3QvCSaE5Am22i8Z 0LonHxPr1p7tB7r2y+aWK0F7G5smY8fA9zy5PzcQIT34nPiAOAz3D5/edd5piwGv5Wie GJRw== 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 q1-v6si35131697plb.35.2018.09.24.05.39.54; Mon, 24 Sep 2018 05:40:10 -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 S2388239AbeIXSkI (ORCPT + 99 others); Mon, 24 Sep 2018 14:40:08 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58680 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387739AbeIXSkI (ORCPT ); Mon, 24 Sep 2018 14:40:08 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 07B7A1097; Mon, 24 Sep 2018 12:38:09 +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.18 132/235] usb: cdc-wdm: Fix a sleep-in-atomic-context bug in service_outstanding_interrupt() Date: Mon, 24 Sep 2018 13:51:58 +0200 Message-Id: <20180924113119.060092870@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113103.999624566@linuxfoundation.org> References: <20180924113103.999624566@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.18-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 @@ -458,7 +458,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,