From: Sowmini Varadhan <sowmini.varadhan@oracle.com>
To: linux-kernel@vger.kernel.org
Cc: sowmini.varadhan@oracle.com, benh@kernel.crashing.org,
akpm@linux-foundation.org, linux@roeck-us.net,
davem@davemloft.net
Subject: [PATCH] iommu-common: Do not try to deref a null iommu->lazy_flush() pointer when n < pool->hint
Date: Wed, 16 Sep 2015 21:50:43 -0400 [thread overview]
Message-ID: <20150917015043.GC13020@oracle.com> (raw)
The check for invoking iommu->lazy_flush() from iommu_tbl_range_alloc()
has to be refactored so that we only call ->lazy_flush() if it is non-null.
Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
---
lib/iommu-common.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/iommu-common.c b/lib/iommu-common.c
index ff19f66..b1c93e9 100644
--- a/lib/iommu-common.c
+++ b/lib/iommu-common.c
@@ -21,8 +21,7 @@ static DEFINE_PER_CPU(unsigned int, iommu_hash_common);
static inline bool need_flush(struct iommu_map_table *iommu)
{
- return (iommu->lazy_flush != NULL &&
- (iommu->flags & IOMMU_NEED_FLUSH) != 0);
+ return ((iommu->flags & IOMMU_NEED_FLUSH) != 0);
}
static inline void set_flush(struct iommu_map_table *iommu)
@@ -211,7 +210,8 @@ unsigned long iommu_tbl_range_alloc(struct device *dev,
goto bail;
}
}
- if (n < pool->hint || need_flush(iommu)) {
+ if (iommu->lazy_flush &&
+ (n < pool->hint || need_flush(iommu))) {
clear_flush(iommu);
iommu->lazy_flush(iommu);
}
--
1.7.1
next reply other threads:[~2015-09-17 1:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-17 1:50 Sowmini Varadhan [this message]
2015-09-17 21:26 ` [PATCH] iommu-common: Do not try to deref a null iommu->lazy_flush() pointer when n < pool->hint Andrew Morton
2015-09-17 21:32 ` Sowmini Varadhan
2015-09-17 21:41 ` Andrew Morton
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=20150917015043.GC13020@oracle.com \
--to=sowmini.varadhan@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=benh@kernel.crashing.org \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
/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