Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1628978

[PATCH 1/1] iommu/amd: fix incorrect error handling

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Pan Bian <bianpan201602@163.com>
Newsgroups linux.kernel
Subject [PATCH 1/1] iommu/amd: fix incorrect error handling
Date Sun, 23 Apr 2017 12:30:02 +0200
Message-ID <tzmWe-7fX-7@gated-at.bofh.it> (permalink)
X-Original-To Joerg Roedel <joro@8bytes.org>, iommu@lists.linux-foundation.org
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=j5BJ/7+ylKgf6VQyTe XQH2MtK/I7dlPQEEzsEgB8T2U=; b=gk3/gGN/leO6cxRKst4XCmsiavhoVEUNrv DYLjJYtmep9c0IB9tIg7oP5pMQt5u/YLaI9ZiKpJFYce70Q1lsPV0NgHoeII4bzA QRKyV4x7zFPSiZMuEgRV9zgT1jb0sYnwk1XHhDAOOPuqT1PM2LUgelz1GSzRndsd LD2VED55o=
X-Mailer git-send-email 1.9.1
X-Cm-Transid DdGowAAHhSKZgPxYcKUhAA--.630S3
X-Coremail-Antispam 1Uf129KBjvdXoWrKF1DCFW3Zw1fZr1rKry8Krg_yoWfWwcEq3 y8XFZ7ArZYkrZ7C3WjyF42v3sYgan8Zrn3ur90gw13AryI9rWkCa4kZrn7XrW2gw4I9asr tr9Yg3WSvry7XjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUngTmDUUUUU==
X-Originating-IP [123.118.194.153]
X-Cm-Senderinfo held01tdqsiiqwqsqiywtou0bp/xtbBXhvC4FaDqPbKywAAst
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 29
Organization linux.* mail to news gateway
X-Original-Cc linux-kernel@vger.kernel.org, Pan Bian <bianpan2016@163.com>
X-Original-Date Sun, 23 Apr 2017 18:23:21 +0800
X-Original-Message-ID <1492943001-1078-1-git-send-email-bianpan201602@163.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1628978

Show key headers only | View raw


From: Pan Bian <bianpan2016@163.com>

In function amd_iommu_bind_pasid(), the control flow jumps to label
out_free when pasid_state->mm and mm is NULL. And mmput(mm) is called.
In function mmput(mm), mm is referenced without validation. This will
result in a NULL dereference bug. This patch fixes the bug.

Signed-off-by: Pan Bian <bianpan2016@163.com>
---
 drivers/iommu/amd_iommu_v2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/amd_iommu_v2.c b/drivers/iommu/amd_iommu_v2.c
index 0633439..6629c47 100644
--- a/drivers/iommu/amd_iommu_v2.c
+++ b/drivers/iommu/amd_iommu_v2.c
@@ -696,9 +696,9 @@ int amd_iommu_bind_pasid(struct pci_dev *pdev, int pasid,
 
 out_unregister:
 	mmu_notifier_unregister(&pasid_state->mn, mm);
+	mmput(mm);
 
 out_free:
-	mmput(mm);
 	free_pasid_state(pasid_state);
 
 out:
-- 
1.9.1

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/1] iommu/amd: fix incorrect error handling Pan Bian <bianpan201602@163.com> - 2017-04-23 12:30 +0200
  Re: [PATCH 1/1] iommu/amd: fix incorrect error handling Joerg Roedel <joro@8bytes.org> - 2017-04-24 12:50 +0200

csiph-web