From: Greg Edwards <gedwards-LfVdkaOWEx8@public.gmane.org>
To: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>,
David Woodhouse <dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH] iommu/vt-d: fix race between free_irte() and get_irte()
Date: Tue, 22 Jul 2014 08:27:19 -0600 [thread overview]
Message-ID: <20140722142719.GA28143@psuche.datadirectnet.com> (raw)
get_irte() can race with free_irte() and dereference a NULL iommu
pointer.
Signed-off-by: Greg Edwards <gedwards-LfVdkaOWEx8@public.gmane.org>
Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
drivers/iommu/intel_irq_remapping.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c
index 9b17489..2d67e6d 100644
--- a/drivers/iommu/intel_irq_remapping.c
+++ b/drivers/iommu/intel_irq_remapping.c
@@ -70,6 +70,12 @@ static int get_irte(int irq, struct irte *entry)
raw_spin_lock_irqsave(&irq_2_ir_lock, flags);
+ /* ensure we're not racing with free_irte() */
+ if (unlikely(!irq_iommu->iommu)) {
+ raw_spin_unlock_irqrestore(&irq_2_ir_lock, flags);
+ return -1;
+ }
+
index = irq_iommu->irte_index + irq_iommu->sub_handle;
*entry = *(irq_iommu->iommu->ir_table->base + index);
--
1.9.3
WARNING: multiple messages have this Message-ID (diff)
From: Greg Edwards <gedwards@ddn.com>
To: Joerg Roedel <joro@8bytes.org>, David Woodhouse <dwmw2@infradead.org>
Cc: <iommu@lists.linux-foundation.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH] iommu/vt-d: fix race between free_irte() and get_irte()
Date: Tue, 22 Jul 2014 08:27:19 -0600 [thread overview]
Message-ID: <20140722142719.GA28143@psuche.datadirectnet.com> (raw)
get_irte() can race with free_irte() and dereference a NULL iommu
pointer.
Signed-off-by: Greg Edwards <gedwards@ddn.com>
Cc: stable@vger.kernel.org
---
drivers/iommu/intel_irq_remapping.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c
index 9b17489..2d67e6d 100644
--- a/drivers/iommu/intel_irq_remapping.c
+++ b/drivers/iommu/intel_irq_remapping.c
@@ -70,6 +70,12 @@ static int get_irte(int irq, struct irte *entry)
raw_spin_lock_irqsave(&irq_2_ir_lock, flags);
+ /* ensure we're not racing with free_irte() */
+ if (unlikely(!irq_iommu->iommu)) {
+ raw_spin_unlock_irqrestore(&irq_2_ir_lock, flags);
+ return -1;
+ }
+
index = irq_iommu->irte_index + irq_iommu->sub_handle;
*entry = *(irq_iommu->iommu->ir_table->base + index);
--
1.9.3
next reply other threads:[~2014-07-22 14:27 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-22 14:27 Greg Edwards [this message]
2014-07-22 14:27 ` [PATCH] iommu/vt-d: fix race between free_irte() and get_irte() Greg Edwards
[not found] ` <20140722142719.GA28143-+5IcJesBrg1QnCaYh1JbbuXjVpU8mP+x@public.gmane.org>
2014-07-23 14:40 ` Joerg Roedel
2014-07-23 14:40 ` Joerg Roedel
[not found] ` <20140723144024.GA14017-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2014-07-23 14:49 ` Greg Edwards
2014-07-23 14:49 ` Greg Edwards
[not found] ` <20140723144917.GA26986-+5IcJesBrg1QnCaYh1JbbuXjVpU8mP+x@public.gmane.org>
2014-07-23 15:10 ` Joerg Roedel
2014-07-23 15:10 ` Joerg Roedel
[not found] ` <20140723151040.GB14017-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2014-07-23 16:13 ` [PATCH v2] iommu/vt-d: race setting IRQ CPU affinity while freeing IRQ Greg Edwards
2014-07-23 16:13 ` Greg Edwards
[not found] ` <20140723161326.GB32422-+5IcJesBrg1QnCaYh1JbbuXjVpU8mP+x@public.gmane.org>
2014-07-29 10:45 ` Joerg Roedel
2014-07-29 10:45 ` Joerg Roedel
[not found] ` <20140729104531.GB9809-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2014-07-29 17:21 ` Greg Edwards
2014-07-29 17:21 ` Greg Edwards
[not found] ` <20140729172158.GA23529-+5IcJesBrg1QnCaYh1JbbuXjVpU8mP+x@public.gmane.org>
2014-07-31 11:49 ` Joerg Roedel
2014-07-31 11:49 ` Joerg Roedel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140722142719.GA28143@psuche.datadirectnet.com \
--to=gedwards-lfvdkaowex8@public.gmane.org \
--cc=dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.