DPDK patches and discussions
 help / color / Atom feed
* [dpdk-dev] [PATCH] examples/ioat: handle failure case for ioat dequeue
@ 2019-11-25 15:23 Bruce Richardson
  2019-11-25 16:23 ` Bruce Richardson
  0 siblings, 1 reply; 3+ messages in thread
From: Bruce Richardson @ 2019-11-25 15:23 UTC (permalink / raw)
  To: dev; +Cc: 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
Fixes: 2328542ed84e ("examples/ioat: add rawdev copy mode")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 examples/ioat/ioatfwd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/ioat/ioatfwd.c b/examples/ioat/ioatfwd.c
index 5e623a4d5..9fc033bc3 100644
--- a/examples/ioat/ioatfwd.c
+++ b/examples/ioat/ioatfwd.c
@@ -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)
-- 
2.21.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] examples/ioat: handle failure case for ioat dequeue
  2019-11-25 15:23 [dpdk-dev] [PATCH] examples/ioat: handle failure case for ioat dequeue Bruce Richardson
@ 2019-11-25 16:23 ` Bruce Richardson
  2019-11-26 16:27   ` David Marchand
  0 siblings, 1 reply; 3+ messages in thread
From: Bruce Richardson @ 2019-11-25 16:23 UTC (permalink / raw)
  To: dev

On Mon, Nov 25, 2019 at 03:23:03PM +0000, Bruce Richardson wrote:
> 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

> Fixes: 2328542ed84e ("examples/ioat: add rawdev copy mode")
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>  examples/ioat/ioatfwd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/examples/ioat/ioatfwd.c b/examples/ioat/ioatfwd.c
> index 5e623a4d5..9fc033bc3 100644
> --- a/examples/ioat/ioatfwd.c
> +++ b/examples/ioat/ioatfwd.c
> @@ -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)
> -- 
> 2.21.0
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] examples/ioat: handle failure case for ioat dequeue
  2019-11-25 16:23 ` Bruce Richardson
@ 2019-11-26 16:27   ` David Marchand
  0 siblings, 0 replies; 3+ messages in thread
From: David Marchand @ 2019-11-26 16:27 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev

On Mon, Nov 25, 2019 at 5:23 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> On Mon, Nov 25, 2019 at 03:23:03PM +0000, Bruce Richardson wrote:
> > 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
>
> > Fixes: 2328542ed84e ("examples/ioat: add rawdev copy mode")
> >
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>

Applied, thanks.



--
David Marchand


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-25 15:23 [dpdk-dev] [PATCH] examples/ioat: handle failure case for ioat dequeue Bruce Richardson
2019-11-25 16:23 ` Bruce Richardson
2019-11-26 16:27   ` David Marchand

DPDK patches and discussions

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ http://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox