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: <2e648871-b7f7-c77e-6a22-3c26ad90633b@linux.alibaba.com>
Date:   Wed, 20 Nov 2019 21:36:46 +0800
From:   Wen Yang <wenyang@...ux.alibaba.com>
To:     Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     linux-kernel@...r.kernel.org,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        stable@...r.kernel.org
Subject: Re: [GIT PULL 1/3] intel_th: Fix a double put_device() in error path


On 2019/11/20 9:08 下午, Alexander Shishkin wrote:
> Commit a753bfcfdb1f ("intel_th: Make the switch allocate its subdevices")
> factored out intel_th_subdevice_alloc() from intel_th_populate(), but got
> the error path wrong, resulting in two instances of a double put_device()
> on a freshly initialized, but not 'added' device.
>
> Fix this by only doing one put_device() in the error path.
>
> Signed-off-by: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
> Fixes: a753bfcfdb1f ("intel_th: Make the switch allocate its subdevices")
> Reported-by: Wen Yang <wenyang@...ux.alibaba.com>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> Cc: stable@...r.kernel.org # v4.14+
> ---
>   drivers/hwtracing/intel_th/core.c | 8 ++------
>   1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th/core.c
> index d5c1821b31c6..0dfd97bbde9e 100644
> --- a/drivers/hwtracing/intel_th/core.c
> +++ b/drivers/hwtracing/intel_th/core.c
> @@ -649,10 +649,8 @@ intel_th_subdevice_alloc(struct intel_th *th,
>   	}
>   
>   	err = intel_th_device_add_resources(thdev, res, subdev->nres);
> -	if (err) {
> -		put_device(&thdev->dev);
> +	if (err)
>   		goto fail_put_device;
> -	}
>   
>   	if (subdev->type == INTEL_TH_OUTPUT) {
>   		if (subdev->mknode)
> @@ -667,10 +665,8 @@ intel_th_subdevice_alloc(struct intel_th *th,
>   	}
>   
>   	err = device_add(&thdev->dev);
> -	if (err) {
> -		put_device(&thdev->dev);
> +	if (err)
>   		goto fail_free_res;
> -	}
>   
>   	/* need switch driver to be loaded to enumerate the rest */
>   	if (subdev->type == INTEL_TH_SWITCH && !req) {
device_add() has increased the reference count,

so when it returns an error, an additional call to put_device()

is needed here to reduce the reference count.

--

Regards,

Wen


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ