Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3927616imm; Mon, 8 Oct 2018 11:49:46 -0700 (PDT) X-Google-Smtp-Source: ACcGV62Aae5NYxWtgXGz9E+XjcX/QEJsTWJO7cgCc8OwxEq7d2nGmjFSoGHopDtYX6LeKQRgsH95 X-Received: by 2002:a63:dc14:: with SMTP id s20-v6mr12333745pgg.398.1539024586663; Mon, 08 Oct 2018 11:49:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539024586; cv=none; d=google.com; s=arc-20160816; b=X2hBwI1WvpHwnYYb/VSgeiK0TkS5rMqhn34dE7J286/nWjtXjlnbbQz8gqpJXlQFu8 chddcmZA8s6Wk1egNPVjOZ1Di3mbfXrM2kNYvvNSI2F/qM3nr7TnRBOCY17BHOrVxZgA KY9VtB8arxJaHrhdX42ETJ1tN1hW1qJdeR+hGVygXY1nxj400CWlPEZqnqC8xGmlgB+l 9iW7POs6cU2jKtL76E9MRhCpMiRoYdcJPLWMFenRsjXVHzMpWUwHMXXtIq/TLsUK5lQx m+0ilCZuAdXwBfMQtz8HkUaWGhy8NwupL1K6PlMCCmFw2MREJgkZIHvrAPm42LNyG33i 3jmQ== 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:dkim-signature; bh=QypvFbzSumyz5a940jKQ9tssuITzqCoEvS26jJmeYgY=; b=WkVJNpD024bEZgPTu5uH28nkR0SqP/XZmobZ3oCQQd+3zuAD9FIxgzJSDsnDHX37uk Z0xdg5eLY21Zo0I9+luKK7uKlLHNZYK3U+nOjQ3NaMzAMW2MnEJRDIFkYMQRhscH2tlk U8ewZoWcPuOPsyrATnO5uMIexFEcUFjxdV7ny8Pxwo8IqRsbIaH0dwYPgYL1PL1TU/to oMwcLZ+XJuBdmJPo8xVTNGxQmc5SIomhS06I80tHWIO9XAzIB1kdK4DuvCBWINexAjKw DlxfK7jpo7i1T12VSXZzOTzEMQ8FVxR3sg3NDT6RHyaEpHkCy1amaU30B1tbdhHPvGZ6 7oxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gSt9DAWw; 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 k5-v6si17582704pgi.99.2018.10.08.11.49.31; Mon, 08 Oct 2018 11:49:46 -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; dkim=pass header.i=@kernel.org header.s=default header.b=gSt9DAWw; 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 S1731597AbeJICBP (ORCPT + 99 others); Mon, 8 Oct 2018 22:01:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:50200 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728239AbeJICBN (ORCPT ); Mon, 8 Oct 2018 22:01:13 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (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 98FA62087D; Mon, 8 Oct 2018 18:48:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539024487; bh=F52kD4BKSnAA7YNISwpwmaGqUfyWqYW1qjKocjojYiQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gSt9DAWwQtGtENOTGkyNV4CbOyEY7URs9akyr2ZP5e9rCNtghFhhOcXBijdLtS4/P 89EF5HnUyxyHNrQ8SiObCGjAO6SHKs8aEAAH3TFrJ/Km7I88Mfl2Kk6oDmBPAF5bVj U+WvpEERcY/Ma9vCoG7z6rYMoEZnxW08NZrCQYN8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jia-Ju Bai , "David S. Miller" , Sasha Levin Subject: [PATCH 4.18 055/168] net: cadence: Fix a sleep-in-atomic-context bug in macb_halt_tx() Date: Mon, 8 Oct 2018 20:30:35 +0200 Message-Id: <20181008175622.143089820@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181008175620.043587728@linuxfoundation.org> References: <20181008175620.043587728@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 [ Upstream commit 16fe10cf92783ed9ceb182d6ea2b8adf5e8ec1b8 ] The kernel module may sleep with holding a spinlock. The function call paths (from bottom to top) in Linux-4.16 are: [FUNC] usleep_range drivers/net/ethernet/cadence/macb_main.c, 648: usleep_range in macb_halt_tx drivers/net/ethernet/cadence/macb_main.c, 730: macb_halt_tx in macb_tx_error_task drivers/net/ethernet/cadence/macb_main.c, 721: _raw_spin_lock_irqsave in macb_tx_error_task To fix this bug, usleep_range() is replaced with udelay(). This bug is found by my static analysis tool DSAC. Signed-off-by: Jia-Ju Bai Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/cadence/macb_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -648,7 +648,7 @@ static int macb_halt_tx(struct macb *bp) if (!(status & MACB_BIT(TGO))) return 0; - usleep_range(10, 250); + udelay(250); } while (time_before(halt_time, timeout)); return -ETIMEDOUT;