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  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]
Date:   Sun, 14 Jun 2020 02:38:22 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Aditya Pakki <pakki001@....edu>
Cc:     kjlu@....edu, wu000273@....edu, Jean Delvare <jdelvare@...e.com>,
        linux-hwmon@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] hwmon: (ina3221) Fix reference count leak in
 ina3221_write_enable

On 6/13/20 8:38 PM, Aditya Pakki wrote:
> ina3221_write_enable() calls pm_runtime_get_sync() that increments
> the reference counter. In case of failure, decrement the reference
> count and return the error.
> 
> Signed-off-by: Aditya Pakki <pakki001@....edu>
> ---
>  drivers/hwmon/ina3221.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/hwmon/ina3221.c b/drivers/hwmon/ina3221.c
> index f335d0cb0c77..9a3b46160de1 100644
> --- a/drivers/hwmon/ina3221.c
> +++ b/drivers/hwmon/ina3221.c
> @@ -492,6 +492,7 @@ static int ina3221_write_enable(struct device *dev, int channel, bool enable)
>  		ret = pm_runtime_get_sync(ina->pm_dev);
>  		if (ret < 0) {
>  			dev_err(dev, "Failed to get PM runtime\n");
> +			pm_runtime_put_sync(ina->pm_dev);
>  			return ret;
>  		}
>  	}
> 

Looking into other code handling this error, a call to pm_runtime_put_noidle()
may be more appropriate in this situation.

Guenter

Powered by blists - more mailing lists