linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bus: mhi: core: Remove double locking from mhi_driver_remove()
@ 2020-10-15 18:47 Bhaumik Bhatt
  2020-11-05 14:10 ` Manivannan Sadhasivam
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Bhaumik Bhatt @ 2020-10-15 18:47 UTC (permalink / raw)
  To: manivannan.sadhasivam
  Cc: linux-arm-msm, hemantk, jhugo, linux-kernel, skhan, Bhaumik Bhatt

There is double acquisition of the pm_lock from mhi_driver_remove()
function. Remove the read_lock_bh/read_unlock_bh calls for pm_lock
taken during a call to mhi_device_put() as the lock is acquired
within the function already. This will help avoid a potential
kernel panic.

Fixes: 189ff97cca53 ("bus: mhi: core: Add support for data transfer")
Reported-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org>
---
 drivers/bus/mhi/core/init.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c
index 0ffdebd..0a09f82 100644
--- a/drivers/bus/mhi/core/init.c
+++ b/drivers/bus/mhi/core/init.c
@@ -1276,10 +1276,8 @@ static int mhi_driver_remove(struct device *dev)
 		mutex_unlock(&mhi_chan->mutex);
 	}
 
-	read_lock_bh(&mhi_cntrl->pm_lock);
 	while (mhi_dev->dev_wake)
 		mhi_device_put(mhi_dev);
-	read_unlock_bh(&mhi_cntrl->pm_lock);
 
 	return 0;
 }
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] bus: mhi: core: Remove double locking from mhi_driver_remove()
  2020-10-15 18:47 [PATCH] bus: mhi: core: Remove double locking from mhi_driver_remove() Bhaumik Bhatt
@ 2020-11-05 14:10 ` Manivannan Sadhasivam
  2020-11-09 11:59 ` Manivannan Sadhasivam
  2020-12-29 20:15 ` patchwork-bot+linux-arm-msm
  2 siblings, 0 replies; 4+ messages in thread
From: Manivannan Sadhasivam @ 2020-11-05 14:10 UTC (permalink / raw)
  To: Bhaumik Bhatt; +Cc: linux-arm-msm, hemantk, jhugo, linux-kernel, skhan

On Thu, Oct 15, 2020 at 11:47:51AM -0700, Bhaumik Bhatt wrote:
> There is double acquisition of the pm_lock from mhi_driver_remove()
> function. Remove the read_lock_bh/read_unlock_bh calls for pm_lock
> taken during a call to mhi_device_put() as the lock is acquired
> within the function already. This will help avoid a potential
> kernel panic.
> 
> Fixes: 189ff97cca53 ("bus: mhi: core: Add support for data transfer")
> Reported-by: Shuah Khan <skhan@linuxfoundation.org>
> Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org>

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

Thanks,
Mani

> ---
>  drivers/bus/mhi/core/init.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c
> index 0ffdebd..0a09f82 100644
> --- a/drivers/bus/mhi/core/init.c
> +++ b/drivers/bus/mhi/core/init.c
> @@ -1276,10 +1276,8 @@ static int mhi_driver_remove(struct device *dev)
>  		mutex_unlock(&mhi_chan->mutex);
>  	}
>  
> -	read_lock_bh(&mhi_cntrl->pm_lock);
>  	while (mhi_dev->dev_wake)
>  		mhi_device_put(mhi_dev);
> -	read_unlock_bh(&mhi_cntrl->pm_lock);
>  
>  	return 0;
>  }
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] bus: mhi: core: Remove double locking from mhi_driver_remove()
  2020-10-15 18:47 [PATCH] bus: mhi: core: Remove double locking from mhi_driver_remove() Bhaumik Bhatt
  2020-11-05 14:10 ` Manivannan Sadhasivam
@ 2020-11-09 11:59 ` Manivannan Sadhasivam
  2020-12-29 20:15 ` patchwork-bot+linux-arm-msm
  2 siblings, 0 replies; 4+ messages in thread
From: Manivannan Sadhasivam @ 2020-11-09 11:59 UTC (permalink / raw)
  To: Bhaumik Bhatt; +Cc: linux-arm-msm, hemantk, jhugo, linux-kernel, skhan

On Thu, Oct 15, 2020 at 11:47:51AM -0700, Bhaumik Bhatt wrote:
> There is double acquisition of the pm_lock from mhi_driver_remove()
> function. Remove the read_lock_bh/read_unlock_bh calls for pm_lock
> taken during a call to mhi_device_put() as the lock is acquired
> within the function already. This will help avoid a potential
> kernel panic.
> 
> Fixes: 189ff97cca53 ("bus: mhi: core: Add support for data transfer")
> Reported-by: Shuah Khan <skhan@linuxfoundation.org>
> Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org>

Applied to mhi-next!

Thanks,
Mani

> ---
>  drivers/bus/mhi/core/init.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c
> index 0ffdebd..0a09f82 100644
> --- a/drivers/bus/mhi/core/init.c
> +++ b/drivers/bus/mhi/core/init.c
> @@ -1276,10 +1276,8 @@ static int mhi_driver_remove(struct device *dev)
>  		mutex_unlock(&mhi_chan->mutex);
>  	}
>  
> -	read_lock_bh(&mhi_cntrl->pm_lock);
>  	while (mhi_dev->dev_wake)
>  		mhi_device_put(mhi_dev);
> -	read_unlock_bh(&mhi_cntrl->pm_lock);
>  
>  	return 0;
>  }
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] bus: mhi: core: Remove double locking from mhi_driver_remove()
  2020-10-15 18:47 [PATCH] bus: mhi: core: Remove double locking from mhi_driver_remove() Bhaumik Bhatt
  2020-11-05 14:10 ` Manivannan Sadhasivam
  2020-11-09 11:59 ` Manivannan Sadhasivam
@ 2020-12-29 20:15 ` patchwork-bot+linux-arm-msm
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+linux-arm-msm @ 2020-12-29 20:15 UTC (permalink / raw)
  To: Bhaumik Bhatt; +Cc: linux-arm-msm

Hello:

This patch was applied to qcom/linux.git (refs/heads/for-next):

On Thu, 15 Oct 2020 11:47:51 -0700 you wrote:
> There is double acquisition of the pm_lock from mhi_driver_remove()
> function. Remove the read_lock_bh/read_unlock_bh calls for pm_lock
> taken during a call to mhi_device_put() as the lock is acquired
> within the function already. This will help avoid a potential
> kernel panic.
> 
> Fixes: 189ff97cca53 ("bus: mhi: core: Add support for data transfer")
> Reported-by: Shuah Khan <skhan@linuxfoundation.org>
> Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org>
> 
> [...]

Here is the summary with links:
  - bus: mhi: core: Remove double locking from mhi_driver_remove()
    https://git.kernel.org/qcom/c/9b627c25e708

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-12-29 20:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-15 18:47 [PATCH] bus: mhi: core: Remove double locking from mhi_driver_remove() Bhaumik Bhatt
2020-11-05 14:10 ` Manivannan Sadhasivam
2020-11-09 11:59 ` Manivannan Sadhasivam
2020-12-29 20:15 ` patchwork-bot+linux-arm-msm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).