Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2509196imm; Mon, 24 Sep 2018 05:40:18 -0700 (PDT) X-Google-Smtp-Source: ACcGV61MwocVDX/wXOIIJ9JhJnA8xua4z2v9A+ILN3sx4CqrnZRI1b7BTbf/QT4i/CMPc/OELafv X-Received: by 2002:a63:b5e:: with SMTP id a30-v6mr940891pgl.280.1537792818653; Mon, 24 Sep 2018 05:40:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537792818; cv=none; d=google.com; s=arc-20160816; b=L40c52Ong4Sbx2SOYiGjXmM0kR65UWxwZHvsoMioswUkm6gzT7ws6Wp3AbqnOpp7k0 WSmodrk5pPWpbbh2eXmcwBXu48rdvLFXXi0yGi7bZRdSgRgWt7buZa5VzsPapVGJVVJH fdKA+NY5iTFoOq2mRFzTB6dN3Z1Pey6qBiz/5tz9E76GgOnCeK4dDMX6DClwALBZlf+2 BXrZKJd/Oes5E2Ym9Uzqwh8zhXW+hCHpYfOVmsjRe3B8pS8v/tI/V3MVgImzes95ccVa HIN4YK/2U8gw/9xvFU4cNSROqnwVvZs0ScF2JADAW5cIR5rwydPEhghucSryj1708fHz Zs1g== 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=6pv2tBK1SJqDfdr9ZbFR3EKUsabAh/XrG6x02i7u6fo=; b=auE/PFmlPpVrSSdnXns67wEKinFpOD9j/d3TbMFO5ln4TFmnebORFRYpOuAMRoiHwE cZIPiidQlMgC/Sx/TDuh4fyt+KA+zj+CmmrFMHFeJbq5e42yv3xdx3NLj3/u3UFprewu 0wtovS/XkOh8AOMMAfNjHeJyu4oBoSkbWI8g/+gK/EPAUiUSF3bdEqIRA8ccqSR8eLkr S4qLTTLGl/xHQBGU3OOH77rVUDvsbWvfvkJp0+2mVpeTsmPa8+dTljiG7vq8zWn1ntZS EwFweS3ErztozTUk1wxXw7s5InH69n/pLqiT68gkAD38Qa57Z1EvgGNi8DrID2JAhR+E xUJw== 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 m7-v6si17338443pls.194.2018.09.24.05.40.03; Mon, 24 Sep 2018 05:40:18 -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 S2388399AbeIXSk6 (ORCPT + 99 others); Mon, 24 Sep 2018 14:40:58 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58798 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730741AbeIXSk6 (ORCPT ); Mon, 24 Sep 2018 14:40:58 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id DC0F71098; Mon, 24 Sep 2018 12:39:00 +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 124/235] usb: host: u132-hcd: Fix a sleep-in-atomic-context bug in u132_get_frame() Date: Mon, 24 Sep 2018 13:51:50 +0200 Message-Id: <20180924113118.472963044@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 6d4f268fa132742fe96dad22307c68d237356d88 upstream. i_usX2Y_subs_startup in usbusx2yaudio.c is a completion handler function for the USB driver. So it should not sleep, but it is can sleep according to the function call paths (from bottom to top) in Linux-4.16. [FUNC] msleep drivers/usb/host/u132-hcd.c, 2558: msleep in u132_get_frame drivers/usb/core/hcd.c, 2231: [FUNC_PTR]u132_get_frame in usb_hcd_get_frame_number drivers/usb/core/usb.c, 822: usb_hcd_get_frame_number in usb_get_current_frame_number sound/usb/usx2y/usbusx2yaudio.c, 303: usb_get_current_frame_number in i_usX2Y_urb_complete sound/usb/usx2y/usbusx2yaudio.c, 366: i_usX2Y_urb_complete in i_usX2Y_subs_startup Note that [FUNC_PTR] means a function pointer call is used. To fix this bug, msleep() is replaced with mdelay(). 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/host/u132-hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/usb/host/u132-hcd.c +++ b/drivers/usb/host/u132-hcd.c @@ -2555,7 +2555,7 @@ static int u132_get_frame(struct usb_hcd } else { int frame = 0; dev_err(&u132->platform_dev->dev, "TODO: u132_get_frame\n"); - msleep(100); + mdelay(100); return frame; } }