lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZGfll+nLPL2L6Zyz@rdvivi-mobl4>
Date:   Fri, 19 May 2023 17:09:43 -0400
From:   Rodrigo Vivi <rodrigo.vivi@...nel.org>
To:     Cong Liu <liucong2@...inos.cn>
Cc:     Jani Nikula <jani.nikula@...ux.intel.com>,
        Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
        Rodrigo Vivi <rodrigo.vivi@...el.com>,
        Tvrtko Ursulin <tvrtko.ursulin@...ux.intel.com>,
        David Airlie <airlied@...il.com>,
        Daniel Vetter <daniel@...ll.ch>,
        intel-gfx@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
        dri-devel@...ts.freedesktop.org
Subject: Re: [PATCH v2] drm/i915: Fix memory leaks in function live_nop_switch

On Wed, May 17, 2023 at 01:02:03PM +0800, Cong Liu wrote:
> Be sure to properly free the allocated memory before exiting
> the live_nop_switch function.
> 
> Signed-off-by: Cong Liu <liucong2@...inos.cn>
> Suggested-by: Rodrigo Vivi <rodrigo.vivi@...el.com>

pushed, thanks for the patch

> ---
>  .../gpu/drm/i915/gem/selftests/i915_gem_context.c  | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
> index a81fa6a20f5a..2fb125d0cb5e 100644
> --- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
> @@ -66,7 +66,7 @@ static int live_nop_switch(void *arg)
>  		ctx[n] = live_context(i915, file);
>  		if (IS_ERR(ctx[n])) {
>  			err = PTR_ERR(ctx[n]);
> -			goto out_file;
> +			goto out_ctx;
>  		}
>  	}
>  
> @@ -82,7 +82,7 @@ static int live_nop_switch(void *arg)
>  			this = igt_request_alloc(ctx[n], engine);
>  			if (IS_ERR(this)) {
>  				err = PTR_ERR(this);
> -				goto out_file;
> +				goto out_ctx;
>  			}
>  			if (rq) {
>  				i915_request_await_dma_fence(this, &rq->fence);
> @@ -96,7 +96,7 @@ static int live_nop_switch(void *arg)
>  			intel_gt_set_wedged(to_gt(i915));
>  			i915_request_put(rq);
>  			err = -EIO;
> -			goto out_file;
> +			goto out_ctx;
>  		}
>  		i915_request_put(rq);
>  
> @@ -107,7 +107,7 @@ static int live_nop_switch(void *arg)
>  
>  		err = igt_live_test_begin(&t, i915, __func__, engine->name);
>  		if (err)
> -			goto out_file;
> +			goto out_ctx;
>  
>  		end_time = jiffies + i915_selftest.timeout_jiffies;
>  		for_each_prime_number_from(prime, 2, 8192) {
> @@ -120,7 +120,7 @@ static int live_nop_switch(void *arg)
>  				this = igt_request_alloc(ctx[n % nctx], engine);
>  				if (IS_ERR(this)) {
>  					err = PTR_ERR(this);
> -					goto out_file;
> +					goto out_ctx;
>  				}
>  
>  				if (rq) { /* Force submission order */
> @@ -165,7 +165,7 @@ static int live_nop_switch(void *arg)
>  
>  		err = igt_live_test_end(&t);
>  		if (err)
> -			goto out_file;
> +			goto out_ctx;
>  
>  		pr_info("Switch latencies on %s: 1 = %lluns, %lu = %lluns\n",
>  			engine->name,
> @@ -173,6 +173,8 @@ static int live_nop_switch(void *arg)
>  			prime - 1, div64_u64(ktime_to_ns(times[1]), prime - 1));
>  	}
>  
> +out_ctx:
> +	kfree(ctx);
>  out_file:
>  	fput(file);
>  	return err;
> -- 
> 2.34.1
> 
> 
> No virus found
> 		Checked by Hillstone Network AntiVirus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ