Skip to contentSkip to conversation

examples/ioat: handle failure case for ioat dequeue

PATCH Applied Bruce Richardson 2 participants 3 messages Nov 25, 2019 – Nov 26, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 examples/ioat: handle failure case for ioat dequeue

On a failure with the ioat dequeue, -1 is returned, which was not properly handled. This could lead to out-of-bounds reads on a later loop which assumed a positive return value. Fix this by treating an error as though a dequeue of 0 had been encountered.

Coverity issue: 350342

Fixes 2328542ed84e ("examples/ioat: add rawdev copy mode")
---
 examples/ioat/ioatfwd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
examples/ioat/ioatfwd.c +1 -1
index 5e623a4d5..9fc033bc3 100644
@@ -457,7 +457,7 @@ ioat_tx_port(struct rxtx_port_config *tx_config)
 				MAX_PKT_BURST, NULL);
 		}
 
-		if (nb_dq == 0)
+		if (nb_dq <= 0)
 			return;
 
 		if (copy_mode == COPY_MODE_IOAT_NUM)
Signature · 1 line
2.21.0
#1 lore raw
Quoted 6 lines · Bruce Richardson

On a failure with the ioat dequeue, -1 is returned, which was not properly handled. This could lead to out-of-bounds reads on a later loop which assumed a positive return value. Fix this by treating an error as though a dequeue of 0 had been encountered.

Coverity issue: 350342

FYI: also should fix issue: 350349

Quoted 23 lines
Fixes 2328542ed84e ("examples/ioat: add rawdev copy mode")
---
 examples/ioat/ioatfwd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
examples/ioat/ioatfwd.c +1 -1
index 5e623a4d5..9fc033bc3 100644
@@ -457,7 +457,7 @@ ioat_tx_port(struct rxtx_port_config *tx_config)
 				MAX_PKT_BURST, NULL);
 		}
 
-		if (nb_dq == 0)
+		if (nb_dq <= 0)
 			return;
 
 		if (copy_mode == COPY_MODE_IOAT_NUM)
Signature · 1 line
2.21.0
#2 lore raw
Quoted 13 lines · Bruce Richardson
Quoted 6 lines · Bruce Richardson

On a failure with the ioat dequeue, -1 is returned, which was not properly handled. This could lead to out-of-bounds reads on a later loop which assumed a positive return value. Fix this by treating an error as though a dequeue of 0 had been encountered.

Coverity issue: 350342

FYI: also should fix issue: 350349

Quoted 3 lines
Fixes 2328542ed84e ("examples/ioat: add rawdev copy mode")

Applied, thanks.

--
David Marchand