From: Zhouyi Zhou <zhouzhouyi@gmail.com>
To: Joerg Roedel <joro@8bytes.org>,
<iommu@lists.linux-foundation.org>,
<linux-kernel@vger.kernel.org>
Cc: Zhouyi Zhou <yizhouzhou@ict.ac.cn>
Subject: [PATCH] IOMMU: iommu module do not check NULL return of kmem_cache_zalloc
Date: Tue, 11 Feb 2014 10:12:53 +0800 [thread overview]
Message-ID: <1392084773-16843-1-git-send-email-zhouzhouyi@gmail.com> (raw)
From: Zhouyi Zhou <yizhouzhou@ict.ac.cn>
The function iopte_alloc do not check NULL return of kmem_cache_zalloc,
call iopte_free with argument 0 will panic.
Signed-off-by: Zhouyi Zhou <yizhouzhou@ict.ac.cn>
---
drivers/iommu/omap-iommu.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index bcd78a7..5155714 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -551,7 +551,8 @@ static u32 *iopte_alloc(struct omap_iommu *obj, u32 *iopgd, u32 da)
dev_vdbg(obj->dev, "%s: a new pte:%p\n", __func__, iopte);
} else {
/* We raced, free the reduniovant table */
- iopte_free(iopte);
+ if (iopte)
+ iopte_free(iopte);
}
pte_ready:
--
1.7.10.4
next reply other threads:[~2014-02-11 2:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-11 2:12 Zhouyi Zhou [this message]
2014-03-04 15:41 ` [PATCH] IOMMU: iommu module do not check NULL return of kmem_cache_zalloc 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=1392084773-16843-1-git-send-email-zhouzhouyi@gmail.com \
--to=zhouzhouyi@gmail.com \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=yizhouzhou@ict.ac.cn \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox