Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2464601imm; Mon, 24 Sep 2018 04:59:29 -0700 (PDT) X-Google-Smtp-Source: ACcGV606Qi27iGwGYue0GUI2uhg4rwzbKpcH7TEG5t/J5dEuWEECHrNFwjgqqnphO5YYL7LR3A34 X-Received: by 2002:a63:4243:: with SMTP id p64-v6mr9337702pga.127.1537790369826; Mon, 24 Sep 2018 04:59:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537790369; cv=none; d=google.com; s=arc-20160816; b=G0rYBELsnbLkR5FcDGtowe0ocjpx2KFAypyUNipA2AET4nv1wChebSf9sT48TETqcN o0yNn3MXy45JJHBawUKhh07OLz6uOelYAL2IWxmlWeU3T48aEgEMwVfwAP3ThX34ojNC DV8tEIdXCjTT92yTLQF9o7iU+2Z4W4eXR+joAA9lu0MA+3NdzS83TLhp5UEaUsVRfkuZ I8zjEroIL+rTApYiaixZscU7evzW+ihJyGdZHX3zUXP+R7rifvyE5pkc8rnwTtOtAZ+6 u0UTVZx2nSMjjMAAeRuA9wuvfXMylmVg+D88wd1zImEY9AFd8iLGDioLpZC9QNOG4jQY s6jQ== 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=5YQ3MtWcKn4ZIJmZBE2R537SXmFBLLCtaMxKZ2QwT+8=; b=wEgN+0Znny/emvejomB8s9CmTWdblZxVmsrsK6VEjToWrMfP6IMkwN6pVgf1h8p9Vo DmZlPFKw4gVGXsyhu/v+zJKAD3SFTQGp+OCn8EhKHTtTmOBneCqEGAAzVsh7R5/k3HF+ 8bGH6BZebM3zrpsoNGaiDnps/tXxAUDTNJ3yR93yPVQa55Z6D8+N8CKpeL5K6zvjD356 s9SBTBkt/5w+tJ0H1NCxudMs0dp5+QZTUV9AMdMaqt4/rcrwf3B+JQ+2HoFOPOVx2qKu 4dJhbOiK/9s5K5EDYPpfkrhRAugtzVacuWGFTiB02IFuY6DXOFgmAeTwPBlrN2IL4HKV cLIw== 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 u2-v6si2131250pfn.250.2018.09.24.04.59.14; Mon, 24 Sep 2018 04:59:29 -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 S1729233AbeIXSAE (ORCPT + 99 others); Mon, 24 Sep 2018 14:00:04 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:52366 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729146AbeIXSAD (ORCPT ); Mon, 24 Sep 2018 14:00:03 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id AB9DED64; Mon, 24 Sep 2018 11:58:17 +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.4 38/70] usb: host: u132-hcd: Fix a sleep-in-atomic-context bug in u132_get_frame() Date: Mon, 24 Sep 2018 13:52:37 +0200 Message-Id: <20180924113103.860378395@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113058.420454070@linuxfoundation.org> References: <20180924113058.420454070@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.4-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 @@ -2565,7 +2565,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; } }