Message ID | 20200422095021.497253732@linuxfoundation.org |
---|---|
State | New |
Headers | show
Return-Path: <SRS0=aqQR=6G=vger.kernel.org=stable-owner@kernel.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD472C55186 for <stable@archiver.kernel.org>; Wed, 22 Apr 2020 10:16:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ABCF520775 for <stable@archiver.kernel.org>; Wed, 22 Apr 2020 10:16:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587550580; bh=QeP+z2py5zehTf5cGkwbpGZ5Yi83zG6RPJpUo8i2+no=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=kGx/DpTVX9hxFRRWTd+B7Cq7vhPMUhYjhIcM8mUeycI0Ly+DtZO8w/KaDOiMO8ojW uiAqUr4rhSCWEsS9TFs7IZg23lFMZCgtdnXOYvNej/eWUE+koxdDhd8oIvmwteTNF7 vnTw78D2jHGWjGidVJ0a6LT5jIyhZY7xmAO729Uo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729136AbgDVKQT (ORCPT <rfc822;stable@archiver.kernel.org>); Wed, 22 Apr 2020 06:16:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:50598 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729653AbgDVKPU (ORCPT <rfc822;stable@vger.kernel.org>); Wed, 22 Apr 2020 06:15:20 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 AFB902075A; Wed, 22 Apr 2020 10:15:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587550519; bh=QeP+z2py5zehTf5cGkwbpGZ5Yi83zG6RPJpUo8i2+no=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kKb96tcpOcPEmPh1al3oOIgCVPbeuiZZZEw4szs7zCeckX/zNzsb+P37rx7QkEza1 gE4UdcglqzbzryM/dLqtCpC8S+KQwVcT9du+tGI4rSvZge81uQJaX9gMKcbJLrVocV NLYh0P2eL72/V0lMSGoO6VcV2Kehf14dTGabxwXg= From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, stable@vger.kernel.org, Jacob Pan <jacob.jun.pan@linux.intel.com>, Lu Baolu <baolu.lu@linux.intel.com>, Joerg Roedel <jroedel@suse.de>, Sasha Levin <sashal@kernel.org> Subject: [PATCH 4.19 48/64] iommu/vt-d: Fix mm reference leak Date: Wed, 22 Apr 2020 11:57:32 +0200 Message-Id: <20200422095021.497253732@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200422095008.799686511@linuxfoundation.org> References: <20200422095008.799686511@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: <stable.vger.kernel.org> X-Mailing-List: stable@vger.kernel.org |
Series |
None
|
expand
|
diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c index 5944d3b4dca37..ef3aadec980ee 100644 --- a/drivers/iommu/intel-svm.c +++ b/drivers/iommu/intel-svm.c @@ -620,14 +620,15 @@ static irqreturn_t prq_event_thread(int irq, void *d) * any faults on kernel addresses. */ if (!svm->mm) goto bad_req; - /* If the mm is already defunct, don't handle faults. */ - if (!mmget_not_zero(svm->mm)) - goto bad_req; /* If address is not canonical, return invalid response */ if (!is_canonical_address(address)) goto bad_req; + /* If the mm is already defunct, don't handle faults. */ + if (!mmget_not_zero(svm->mm)) + goto bad_req; + down_read(&svm->mm->mmap_sem); vma = find_extend_vma(svm->mm, address); if (!vma || address < vma->vm_start)