Received: by 10.223.185.116 with SMTP id b49csp1092204wrg; Fri, 23 Feb 2018 11:47:51 -0800 (PST) X-Google-Smtp-Source: AH8x224Yyqnfqdtt7CoAdEXt3fkh3+GJdzOMa9BWW59g44Yhgah3nD6W93v7iCQiRvKSNHDAfbQH X-Received: by 2002:a17:902:b101:: with SMTP id q1-v6mr2708388plr.287.1519415271419; Fri, 23 Feb 2018 11:47:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519415271; cv=none; d=google.com; s=arc-20160816; b=vOWQWRGuEd82FtC9wq0izyLNE0GmyS4runBlVpGaVPG1Hgd7l1H8xUV53I5MknttoR eyigdut5mVkl/6FRY8pcfYeXrTv4gawPoyN/bAY/rNPQYqYBzyqGYy1qSxdDNyTKfgnE G71BX6SvsxkLnhRzuQ3xbICNL/ZKOJbpT+HHZqEz3lKoayUd4MAWAgukZc5/pZJENa5W 9wE+uVnKapsReS22xq/WVn5LTMwJhpDmO89wWaJOaoDdWPPzALAR1r0fcOmqkuC9Ldgm Du1kmDB2uxFvCrMC+Y9YVGsr6VQe5FBKWlQMAHGsCu2dqt0CunXf2Oaf9eVQKLExMleq Fxmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=MHj6CcmN3VbpnUtEIUtMUlWwVwQl8uZbKViNlZ3xrZ4=; b=lSuf3D9DUaZTWE76/EIevWAkxsptHFQf8TzfGu641nXA+fGDG/xL/n/KPFu0NH42LL tbqo9EaHMexFZ8N2r153OeIjF7FOLRrNoqEqlxAfU8lnBjREk0ZtejzlPLHtp7qAheTb sLaylayUEN1BKiAsoFBdx69fOWWvQufKk/rtfZMmWO3+mPEXowlXdFXAA29fgDTiXEYw S0jZE6ZK4z9OmjLY17dxXPJCub4L8AeV5RS3iaq4s8Mv+9UU99NLj7PqOwAZLhlOtn96 gjIcgTIwPJFaYlyxcgUZR1JOZ7SoGZV8bii7CVTYVpgN0ySGf7YaXRdJEMYj6GTuaGTz czbQ== 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 j13si2228985pfh.78.2018.02.23.11.47.36; Fri, 23 Feb 2018 11:47:51 -0800 (PST) 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 S934259AbeBWSrv (ORCPT + 99 others); Fri, 23 Feb 2018 13:47:51 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:44664 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933902AbeBWSrt (ORCPT ); Fri, 23 Feb 2018 13:47:49 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 46033FDC; Fri, 23 Feb 2018 18:47:48 +0000 (UTC) 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.9 086/145] hippi: Fix a Fix a possible sleep-in-atomic bug in rr_close Date: Fri, 23 Feb 2018 19:26:32 +0100 Message-Id: <20180223170735.866387677@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180223170724.669759283@linuxfoundation.org> References: <20180223170724.669759283@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 [ Upstream commit 6e266610eb6553cfb7e7eb5d11914bd01509c406 ] The driver may sleep under a spinlock. The function call path is: rr_close (acquire the spinlock) free_irq --> may sleep To fix it, free_irq is moved to the place without holding the spinlock. This bug is found by my static analysis tool(DSAC) and checked by my code review. 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/hippi/rrunner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/hippi/rrunner.c +++ b/drivers/net/hippi/rrunner.c @@ -1381,8 +1381,8 @@ static int rr_close(struct net_device *d rrpriv->info_dma); rrpriv->info = NULL; - free_irq(pdev->irq, dev); spin_unlock_irqrestore(&rrpriv->lock, flags); + free_irq(pdev->irq, dev); return 0; }