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: <1132644d-4cf0-a620-3adf-08245dd890ba@xilinx.com>
Date:   Thu, 8 Apr 2021 13:30:51 +0200
From:   Michal Simek <michal.simek@...inx.com>
To:     Pu Lehui <pulehui@...wei.com>, <michal.simek@...inx.com>,
        Raviteja Narayanam <raviteja.narayanam@...inx.com>,
        Shubhrajyoti Datta <shubhrajyoti.datta@...inx.com>
CC:     <linux-arm-kernel@...ts.infradead.org>,
        <linux-i2c@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <yangjihong1@...wei.com>, <zhangjinhao2@...wei.com>
Subject: Re: [PATCH -next] i2c: cadence: Fix PM reference leak in
 cdns_i2c_master_xfer()



On 4/8/21 1:23 PM, Pu Lehui wrote:
> pm_runtime_get_sync() will increment pm usage counter even it failed.
> Forgetting to putting operation will result in reference leak here.
> Fix it by replacing it with pm_runtime_resume_and_get() to keep usage
> counter balanced.
> 
> Signed-off-by: Pu Lehui <pulehui@...wei.com>
> ---
>  drivers/i2c/busses/i2c-cadence.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
> index e4b7f2a951ad..e8eae8725900 100644
> --- a/drivers/i2c/busses/i2c-cadence.c
> +++ b/drivers/i2c/busses/i2c-cadence.c
> @@ -789,7 +789,7 @@ static int cdns_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
>  	bool change_role = false;
>  #endif
>  
> -	ret = pm_runtime_get_sync(id->dev);
> +	ret = pm_runtime_resume_and_get(id->dev);
>  	if (ret < 0)
>  		return ret;
>  
> @@ -911,7 +911,7 @@ static int cdns_reg_slave(struct i2c_client *slave)
>  	if (slave->flags & I2C_CLIENT_TEN)
>  		return -EAFNOSUPPORT;
>  
> -	ret = pm_runtime_get_sync(id->dev);
> +	ret = pm_runtime_resume_and_get(id->dev);
>  	if (ret < 0)
>  		return ret;
>  
> 

Ravi/Shubhrajyoti: Please take a look at this.

Thanks,
Michal

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ