* [PATCH v3 0/2] ioatdma: fix overflow of u16 variables
@ 2015-08-05 16:40 Allen Hubbe
2015-08-05 16:40 ` [PATCH v3 1/2] ioatdma: fix overflow of u16 in ring_reshape Allen Hubbe
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Allen Hubbe @ 2015-08-05 16:40 UTC (permalink / raw)
To: Dan Williams, Dave Jiang; +Cc: dmaengine, linux-kernel, Allen Hubbe
Fix overflow of u16 variables in ioatdma.
Allen Hubbe (2):
ioatdma: fix overflow of u16 in ring_reshape
ioatdma: fix overflow of u16 in freeing resources
drivers/dma/ioat/dma.c | 2 +-
drivers/dma/ioat/init.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
--
2.5.0.rc1
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH v3 1/2] ioatdma: fix overflow of u16 in ring_reshape
2015-08-05 16:40 [PATCH v3 0/2] ioatdma: fix overflow of u16 variables Allen Hubbe
@ 2015-08-05 16:40 ` Allen Hubbe
2015-08-05 16:41 ` [PATCH v3 2/2] ioatdma: fix overflow of u16 in freeing resources Allen Hubbe
2015-08-11 7:38 ` [PATCH v3 0/2] ioatdma: fix overflow of u16 variables Vinod Koul
2 siblings, 0 replies; 5+ messages in thread
From: Allen Hubbe @ 2015-08-05 16:40 UTC (permalink / raw)
To: Dan Williams, Dave Jiang; +Cc: dmaengine, linux-kernel, Allen Hubbe
If the allocation order is 16, then the u16 index will overflow and wrap
to zero instead of being equal or greater than 1 << 16. The loop
condition will always be true, and the loop will run until all the
memory resources are depleted.
Change the type of index 'i' to u32, so that it is large enough to store
a value equal or greater than 1 << 16.
Signed-off-by: Allen Hubbe <Allen.Hubbe@emc.com>
---
drivers/dma/ioat/dma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c
index a5630966834e..7435585dbbd6 100644
--- a/drivers/dma/ioat/dma.c
+++ b/drivers/dma/ioat/dma.c
@@ -372,7 +372,7 @@ static bool reshape_ring(struct ioatdma_chan *ioat_chan, int order)
const u16 active = ioat_ring_active(ioat_chan);
const u32 new_size = 1 << order;
struct ioat_ring_ent **ring;
- u16 i;
+ u32 i;
if (order > ioat_get_max_alloc_order())
return false;
--
2.5.0.rc1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v3 2/2] ioatdma: fix overflow of u16 in freeing resources
2015-08-05 16:40 [PATCH v3 0/2] ioatdma: fix overflow of u16 variables Allen Hubbe
2015-08-05 16:40 ` [PATCH v3 1/2] ioatdma: fix overflow of u16 in ring_reshape Allen Hubbe
@ 2015-08-05 16:41 ` Allen Hubbe
2015-08-11 7:38 ` [PATCH v3 0/2] ioatdma: fix overflow of u16 variables Vinod Koul
2 siblings, 0 replies; 5+ messages in thread
From: Allen Hubbe @ 2015-08-05 16:41 UTC (permalink / raw)
To: Dan Williams, Dave Jiang; +Cc: dmaengine, linux-kernel, Allen Hubbe
If the allocation order is 16, then the u16 count will overflow and wrap
to zero when assigned the value 1 << 16.
Change the type of 'total_descs' to int, so that it is large enough to
store a value equal or greater than 1 << 16.
Signed-off-by: Allen Hubbe <Allen.Hubbe@emc.com>
---
drivers/dma/ioat/init.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma/ioat/init.c b/drivers/dma/ioat/init.c
index 2c6846a12688..f078af445d5c 100644
--- a/drivers/dma/ioat/init.c
+++ b/drivers/dma/ioat/init.c
@@ -603,7 +603,7 @@ static void ioat_free_chan_resources(struct dma_chan *c)
struct ioatdma_chan *ioat_chan = to_ioat_chan(c);
struct ioatdma_device *ioat_dma = ioat_chan->ioat_dma;
struct ioat_ring_ent *desc;
- const u16 total_descs = 1 << ioat_chan->alloc_order;
+ const int total_descs = 1 << ioat_chan->alloc_order;
int descs;
int i;
--
2.5.0.rc1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v3 0/2] ioatdma: fix overflow of u16 variables
2015-08-05 16:40 [PATCH v3 0/2] ioatdma: fix overflow of u16 variables Allen Hubbe
2015-08-05 16:40 ` [PATCH v3 1/2] ioatdma: fix overflow of u16 in ring_reshape Allen Hubbe
2015-08-05 16:41 ` [PATCH v3 2/2] ioatdma: fix overflow of u16 in freeing resources Allen Hubbe
@ 2015-08-11 7:38 ` Vinod Koul
2015-08-11 12:47 ` Allen Hubbe
2 siblings, 1 reply; 5+ messages in thread
From: Vinod Koul @ 2015-08-11 7:38 UTC (permalink / raw)
To: Allen Hubbe; +Cc: Dan Williams, Dave Jiang, dmaengine, linux-kernel
On Wed, Aug 05, 2015 at 12:40:58PM -0400, Allen Hubbe wrote:
> Fix overflow of u16 variables in ioatdma.
This fails for me, was it generated on top of Dave's series
--
~Vinod
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH v3 0/2] ioatdma: fix overflow of u16 variables
2015-08-11 7:38 ` [PATCH v3 0/2] ioatdma: fix overflow of u16 variables Vinod Koul
@ 2015-08-11 12:47 ` Allen Hubbe
0 siblings, 0 replies; 5+ messages in thread
From: Allen Hubbe @ 2015-08-11 12:47 UTC (permalink / raw)
To: 'Vinod Koul'
Cc: 'Dan Williams', 'Dave Jiang', dmaengine,
linux-kernel
From: Vinod Koul
> This fails for me, was it generated on top of Dave's series
Would you prefer this based on Linus' current rc6 instead of Dave's? I will do that, and send v5.
This was generated on top of Dave's, as of v2 of this series. We figured it would be easier to base the smaller patch on Dave's, considering the relative number and complexity of the patches, and also considering that his series was already Ack'd. If you accept v5, then Dave will have some rework.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-08-11 12:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-05 16:40 [PATCH v3 0/2] ioatdma: fix overflow of u16 variables Allen Hubbe
2015-08-05 16:40 ` [PATCH v3 1/2] ioatdma: fix overflow of u16 in ring_reshape Allen Hubbe
2015-08-05 16:41 ` [PATCH v3 2/2] ioatdma: fix overflow of u16 in freeing resources Allen Hubbe
2015-08-11 7:38 ` [PATCH v3 0/2] ioatdma: fix overflow of u16 variables Vinod Koul
2015-08-11 12:47 ` Allen Hubbe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox