Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: manivannan.sadhasivam@linaro.org, hemantk@codeaurora.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	jhugo@codeaurora.org, sdias@codeaurora.org,
	bbhatt@codeaurora.org, linux-arm-msm@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: bus/mhi/core: Double lock in mhi_device_put() and dev_wake inc/dec
Date: Thu, 17 Sep 2020 17:16:40 -0600	[thread overview]
Message-ID: <5029d4b5-d614-eef3-5a7a-9c8e1c3e7ddb@linuxfoundation.org> (raw)

While looking at this file for an unrelated issue, I happen to notice
there is a double locking on mhi_cntrl->pm_lock in the mhi_device_put()
when it gets called from mhi_driver_remove()

The other two calls from mhi_driver_probe() don't hold the pm_lock.

In addition, lock holding while dev_wake updates is inconsistent.

dev_wake gets incremented and decremented without holding pm_lock in
mhi_device_get(), mhi_device_get_sync() and mhi_device_put().

Exception are when mhi_device_put() is called from mhi_driver_remove().

The following commit is where all this code is added.

bus: mhi: core: Add support for data transfer
https://github.com/torvalds/linux/commit/189ff97cca53e3fe2d8b38d64105040ce17fc62d

It appears to be real problem. I don't have a way to test this driver,
hence reaching out to let you know about my findings.

thanks,
-- Shuah

             reply	other threads:[~2020-09-17 23:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-17 23:16 Shuah Khan [this message]
2020-09-19  2:34 ` bus/mhi/core: Double lock in mhi_device_put() and dev_wake inc/dec bbhatt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5029d4b5-d614-eef3-5a7a-9c8e1c3e7ddb@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=bbhatt@codeaurora.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hemantk@codeaurora.org \
    --cc=jhugo@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=sdias@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox