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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250820184514.0cf9cbb5@kernel.org>
Date: Wed, 20 Aug 2025 18:45:14 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Tony Nguyen <anthony.l.nguyen@...el.com>
Cc: davem@...emloft.net, pabeni@...hat.com, edumazet@...gle.com,
 andrew+netdev@...n.ch, netdev@...r.kernel.org, Emil Tantilov
 <emil.s.tantilov@...el.com>, david.m.ertman@...el.com,
 tatyana.e.nikolova@...el.com, Przemek Kitszel
 <przemyslaw.kitszel@...el.com>, Aleksandr Loktionov
 <aleksandr.loktionov@...el.com>
Subject: Re: [PATCH net v2 2/5] ice: fix possible leak in ice_plug_aux_dev()
 error path

On Tue, 19 Aug 2025 15:19:56 -0700 Tony Nguyen wrote:
>  	ret = auxiliary_device_init(adev);
> -	if (ret) {
> -		kfree(iadev);
> -		return ret;
> -	}
> +	if (ret)
> +		goto free_iadev;
>  
>  	ret = auxiliary_device_add(adev);
> -	if (ret) {
> -		auxiliary_device_uninit(adev);
> -		return ret;

I think the code is correct as is. Once auxiliary_device_init()
returns the device is refcounted, auxiliary_device_uninit()
will call release, which is ice_adev_release(), which in turn
frees iadev.

> -	}
> +	if (ret)
> +		goto aux_dev_uninit;
>  
>  	mutex_lock(&pf->adev_mutex);
>  	cdev->adev = adev;
> @@ -339,6 +335,13 @@ int ice_plug_aux_dev(struct ice_pf *pf)
>  	set_bit(ICE_FLAG_AUX_DEV_CREATED, pf->flags);
>  
>  	return 0;
> +
> +aux_dev_uninit:
> +	auxiliary_device_uninit(adev);
> +free_iadev:
> +	kfree(iadev);
> +
> +	return ret;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ