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


Groups > linux.kernel > #1226623 > unrolled thread

[PATCH] iommu-common: Do not try to deref a null iommu->lazy_flush() pointer when n < pool->hint

Started bySowmini Varadhan <sowmini.varadhan@oracle.com>
First post2015-09-17 04:00 +0200
Last post2015-09-17 23:50 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] iommu-common: Do not try to deref a null iommu->lazy_flush()  pointer when n < pool->hint Sowmini Varadhan <sowmini.varadhan@oracle.com> - 2015-09-17 04:00 +0200
    Re: [PATCH] iommu-common: Do not try to deref a null  iommu->lazy_flush() pointer when n < pool->hint Andrew Morton <akpm@linux-foundation.org> - 2015-09-17 23:30 +0200
      Re: [PATCH] iommu-common: Do not try to deref a null  iommu->lazy_flush() pointer when n < pool->hint Sowmini Varadhan <sowmini.varadhan@oracle.com> - 2015-09-17 23:40 +0200
        Re: [PATCH] iommu-common: Do not try to deref a null  iommu->lazy_flush() pointer when n < pool->hint Andrew Morton <akpm@linux-foundation.org> - 2015-09-17 23:50 +0200

#1226623 — [PATCH] iommu-common: Do not try to deref a null iommu->lazy_flush() pointer when n < pool->hint

FromSowmini Varadhan <sowmini.varadhan@oracle.com>
Date2015-09-17 04:00 +0200
Subject[PATCH] iommu-common: Do not try to deref a null iommu->lazy_flush() pointer when n < pool->hint
Message-ID<q9wEq-5yg-7@gated-at.bofh.it>
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1227407 — Re: [PATCH] iommu-common: Do not try to deref a null iommu->lazy_flush() pointer when n < pool->hint

FromAndrew Morton <akpm@linux-foundation.org>
Date2015-09-17 23:30 +0200
SubjectRe: [PATCH] iommu-common: Do not try to deref a null iommu->lazy_flush() pointer when n < pool->hint
Message-ID<q9OUG-7wd-13@gated-at.bofh.it>
In reply to#1226623
On Wed, 16 Sep 2015 21:50:43 -0400 Sowmini Varadhan <sowmini.varadhan@oracle.com> wrote:

> 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.

Patch looks good.

But I don't know which kernel versions need the fix.  So, when fixing a
bug please always describe the end-user visible effects of that bug. 
Under what circumstances did your kernel crash?


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1227418 — Re: [PATCH] iommu-common: Do not try to deref a null iommu->lazy_flush() pointer when n < pool->hint

FromSowmini Varadhan <sowmini.varadhan@oracle.com>
Date2015-09-17 23:40 +0200
SubjectRe: [PATCH] iommu-common: Do not try to deref a null iommu->lazy_flush() pointer when n < pool->hint
Message-ID<q9P4m-7Hx-1@gated-at.bofh.it>
In reply to#1227407
On (09/17/15 14:26), Andrew Morton wrote:
> Patch looks good.
> 
> But I don't know which kernel versions need the fix.  So, when fixing a
> bug please always describe the end-user visible effects of that bug. 
> Under what circumstances did your kernel crash?
> 

I had a sparc kernel that was crashing when I was trying to process
some very large perf.data files- the crash happens when the scsi
driver calls into dma_4v_map_sg and thus the iommu_tbl_range_alloc().

Do you need me to respin the patch with the above info in the 
commit id?

--Sowmini
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1227425 — Re: [PATCH] iommu-common: Do not try to deref a null iommu->lazy_flush() pointer when n < pool->hint

FromAndrew Morton <akpm@linux-foundation.org>
Date2015-09-17 23:50 +0200
SubjectRe: [PATCH] iommu-common: Do not try to deref a null iommu->lazy_flush() pointer when n < pool->hint
Message-ID<q9Pe1-7Ti-13@gated-at.bofh.it>
In reply to#1227418
On Thu, 17 Sep 2015 17:32:13 -0400 Sowmini Varadhan <sowmini.varadhan@oracle.com> wrote:

> On (09/17/15 14:26), Andrew Morton wrote:
> > Patch looks good.
> > 
> > But I don't know which kernel versions need the fix.  So, when fixing a
> > bug please always describe the end-user visible effects of that bug. 
> > Under what circumstances did your kernel crash?
> > 
> 
> I had a sparc kernel that was crashing when I was trying to process
> some very large perf.data files- the crash happens when the scsi
> driver calls into dma_4v_map_sg and thus the iommu_tbl_range_alloc().

Cool, thanks.

> Do you need me to respin the patch with the above info in the 
> commit id?

No, that's fine.  I updated the changelog, added cc:stable and shall
send it upstream next week.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web