DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] examples/fips_validation: fix resource leak on failure
@ 2020-10-28 15:53 Ciara Power
  2020-10-30 13:08 ` David Marchand
  2020-10-30 17:36 ` [dpdk-dev] [PATCH v2] " Ciara Power
  0 siblings, 2 replies; 4+ messages in thread
From: Ciara Power @ 2020-10-28 15:53 UTC (permalink / raw)
  To: dev; +Cc: Ciara Power, roy.fan.zhang, Marko Kovacevic

The dst variable went out of scope on failure in the get_writeback_data
function. This is now freed before returning -1.

Coverity issue: 363453
Fixes: 952e10cdad5e ("examples/fips_validation: support scatter gather list")
Cc: roy.fan.zhang@intel.com

Signed-off-by: Ciara Power <ciara.power@intel.com>
---
 examples/fips_validation/main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c
index 07532c9562..be38eb29b6 100644
--- a/examples/fips_validation/main.c
+++ b/examples/fips_validation/main.c
@@ -1128,6 +1128,7 @@ get_writeback_data(struct fips_val *val)
 
 	if (data_len) {
 		RTE_LOG(ERR, USER1, "Error -1: write back data\n");
+		free(dst);
 		return -1;
 	}
 
-- 
2.25.1


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

* Re: [dpdk-dev] [PATCH] examples/fips_validation: fix resource leak on failure
  2020-10-28 15:53 [dpdk-dev] [PATCH] examples/fips_validation: fix resource leak on failure Ciara Power
@ 2020-10-30 13:08 ` David Marchand
  2020-10-30 17:36 ` [dpdk-dev] [PATCH v2] " Ciara Power
  1 sibling, 0 replies; 4+ messages in thread
From: David Marchand @ 2020-10-30 13:08 UTC (permalink / raw)
  To: Ciara Power; +Cc: dev, Fan Zhang, Marko Kovacevic

On Wed, Oct 28, 2020 at 4:53 PM Ciara Power <ciara.power@intel.com> wrote:
>
> The dst variable went out of scope on failure in the get_writeback_data
> function. This is now freed before returning -1.
>
> Coverity issue: 363453
> Fixes: 952e10cdad5e ("examples/fips_validation: support scatter gather list")
> Cc: roy.fan.zhang@intel.com
>
> Signed-off-by: Ciara Power <ciara.power@intel.com>
> ---
>  examples/fips_validation/main.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c
> index 07532c9562..be38eb29b6 100644
> --- a/examples/fips_validation/main.c
> +++ b/examples/fips_validation/main.c
> @@ -1128,6 +1128,7 @@ get_writeback_data(struct fips_val *val)
>
>         if (data_len) {
>                 RTE_LOG(ERR, USER1, "Error -1: write back data\n");
> +               free(dst);

Hum should we instead free the pointer to the allocated buffer, i.e.
wb_data, rather than dst that got potentially incremented?


-- 
David Marchand


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

* [dpdk-dev] [PATCH v2] examples/fips_validation: fix resource leak on failure
  2020-10-28 15:53 [dpdk-dev] [PATCH] examples/fips_validation: fix resource leak on failure Ciara Power
  2020-10-30 13:08 ` David Marchand
@ 2020-10-30 17:36 ` Ciara Power
  2020-10-31 17:09   ` David Marchand
  1 sibling, 1 reply; 4+ messages in thread
From: Ciara Power @ 2020-10-30 17:36 UTC (permalink / raw)
  To: dev; +Cc: david.marchand, Ciara Power, roy.fan.zhang, Marko Kovacevic

The wb_data variable went out of scope on failure in the
get_writeback_data function. This is now freed before returning -1.

Coverity issue: 363453
Fixes: 952e10cdad5e ("examples/fips_validation: support scatter gather list")
Cc: roy.fan.zhang@intel.com

Signed-off-by: Ciara Power <ciara.power@intel.com>

---
v2: Fixed incorrect pointer used in free.
---
 examples/fips_validation/main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c
index 07532c9562..b37eb41c0d 100644
--- a/examples/fips_validation/main.c
+++ b/examples/fips_validation/main.c
@@ -1128,6 +1128,7 @@ get_writeback_data(struct fips_val *val)
 
 	if (data_len) {
 		RTE_LOG(ERR, USER1, "Error -1: write back data\n");
+		free(wb_data);
 		return -1;
 	}
 
-- 
2.25.1


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

* Re: [dpdk-dev] [PATCH v2] examples/fips_validation: fix resource leak on failure
  2020-10-30 17:36 ` [dpdk-dev] [PATCH v2] " Ciara Power
@ 2020-10-31 17:09   ` David Marchand
  0 siblings, 0 replies; 4+ messages in thread
From: David Marchand @ 2020-10-31 17:09 UTC (permalink / raw)
  To: Ciara Power; +Cc: dev, Fan Zhang, Marko Kovacevic

On Fri, Oct 30, 2020 at 6:36 PM Ciara Power <ciara.power@intel.com> wrote:
>
> The wb_data variable went out of scope on failure in the
> get_writeback_data function. This is now freed before returning -1.
>
> Coverity issue: 363453
> Fixes: 952e10cdad5e ("examples/fips_validation: support scatter gather list")
>
> Signed-off-by: Ciara Power <ciara.power@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>

Applied, thanks.

-- 
David Marchand


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

end of thread, other threads:[~2020-10-31 17:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-28 15:53 [dpdk-dev] [PATCH] examples/fips_validation: fix resource leak on failure Ciara Power
2020-10-30 13:08 ` David Marchand
2020-10-30 17:36 ` [dpdk-dev] [PATCH v2] " Ciara Power
2020-10-31 17:09   ` David Marchand

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://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/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


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