* [patch] iommu/amd: use after free in get_irq_table()
@ 2012-10-02 8:34 Dan Carpenter
[not found] ` <20121002083439.GN12398-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2012-10-02 8:34 UTC (permalink / raw)
To: Joerg Roedel
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
We should return NULL on error instead of the freed pointer.
Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index e78b8a4..a636d68 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -3867,6 +3867,7 @@ static struct irq_remap_table *get_irq_table(u16 devid, bool ioapic)
table->table = kmem_cache_alloc(amd_iommu_irq_cache, GFP_ATOMIC);
if (!table->table) {
kfree(table);
+ table = NULL;
goto out;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] iommu/amd: use after free in get_irq_table()
[not found] ` <20121002083439.GN12398-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
@ 2012-10-02 10:09 ` Joerg Roedel
0 siblings, 0 replies; 2+ messages in thread
From: Joerg Roedel @ 2012-10-02 10:09 UTC (permalink / raw)
To: Dan Carpenter
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
On Tue, Oct 02, 2012 at 11:34:40AM +0300, Dan Carpenter wrote:
> We should return NULL on error instead of the freed pointer.
>
> Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
>
> diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
> index e78b8a4..a636d68 100644
> --- a/drivers/iommu/amd_iommu.c
> +++ b/drivers/iommu/amd_iommu.c
> @@ -3867,6 +3867,7 @@ static struct irq_remap_table *get_irq_table(u16 devid, bool ioapic)
> table->table = kmem_cache_alloc(amd_iommu_irq_cache, GFP_ATOMIC);
> if (!table->table) {
> kfree(table);
> + table = NULL;
> goto out;
> }
Good catch. Thanks, applied.
--
AMD Operating System Research Center
Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-10-02 10:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-02 8:34 [patch] iommu/amd: use after free in get_irq_table() Dan Carpenter
[not found] ` <20121002083439.GN12398-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
2012-10-02 10:09 ` Joerg Roedel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).