linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hemant Kumar <hemantk@codeaurora.org>
To: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
	Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-arm-msm@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [bug report] bus: mhi: core: Add support for data transfer
Date: Thu, 16 Apr 2020 20:37:16 -0700	[thread overview]
Message-ID: <d30c7648-b657-d8b2-ba64-71f1178b4a68@codeaurora.org> (raw)
In-Reply-To: <20200407143304.GH2442@Mani-XPS-13-9360>


On 4/7/20 7:33 AM, Manivannan Sadhasivam wrote:
> Hi Dan,
>
> On Tue, Apr 07, 2020 at 04:55:59PM +0300, Dan Carpenter wrote:
>> Hello Manivannan Sadhasivam,
>>
>> The patch 189ff97cca53: "bus: mhi: core: Add support for data
>> transfer" from Feb 20, 2020, leads to the following static checker
>> warning:
>>
>> 	drivers/bus/mhi/core/main.c:1153 mhi_queue_buf()
>> 	error: double locked 'mhi_chan->lock' (orig line 1110)
>>
>> drivers/bus/mhi/core/main.c
>>    1142          }
>>    1143
>>    1144          /* Toggle wake to exit out of M2 */
>>    1145          mhi_cntrl->wake_toggle(mhi_cntrl);
>>    1146
>>    1147          if (mhi_chan->dir == DMA_TO_DEVICE)
>>    1148                  atomic_inc(&mhi_cntrl->pending_pkts);
>>    1149
>>    1150          if (likely(MHI_DB_ACCESS_VALID(mhi_cntrl))) {
>>    1151                  unsigned long flags;
>>    1152
>>    1153                  read_lock_irqsave(&mhi_chan->lock, flags);

parse_xfer_event is taking read lock : read_lock_bh(&mhi_chan->lock); 
first and later

mhi_queue_buf takes read lock: read_lock_irqsave(&mhi_chan->lock, flags);

Both are read locks which are recursive, is this problematic ?

>>                                            ^^^^^^^^^^^^^^^
>> The caller is already holding this lock.
>>
> Hmm. We have one internal user of this function and that's where the locking
> has gone wrong. Will fix it.
>
> Thanks for reporting!
>
> Regards,
> Mani
>
>>    1154                  mhi_ring_chan_db(mhi_cntrl, mhi_chan);
>>    1155                  read_unlock_irqrestore(&mhi_chan->lock, flags);
>>    1156          }
>>    1157
>>    1158          read_unlock_irqrestore(&mhi_cntrl->pm_lock, flags);
>>    1159
>>    1160          return 0;
>>    1161  }
>>    1162  EXPORT_SYMBOL_GPL(mhi_queue_buf);
>>
>> regards,
>> dan carpenter

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

  reply	other threads:[~2020-04-17  3:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-07 13:55 [bug report] bus: mhi: core: Add support for data transfer Dan Carpenter
2020-04-07 14:33 ` Manivannan Sadhasivam
2020-04-17  3:37   ` Hemant Kumar [this message]
2020-04-17 10:14     ` Manivannan Sadhasivam
2020-04-17 10:24       ` Dan Carpenter
2020-04-18  7:10       ` Hemant Kumar
2020-04-18 19:19         ` Manivannan Sadhasivam
2020-04-20 22:57           ` Hemant Kumar
2020-04-21  5:52             ` Manivannan Sadhasivam
2020-04-21  6:03 ` Manivannan Sadhasivam
2020-04-07 13:56 Dan Carpenter
2020-04-07 14:31 ` Manivannan Sadhasivam

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=d30c7648-b657-d8b2-ba64-71f1178b4a68@codeaurora.org \
    --to=hemantk@codeaurora.org \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.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;
as well as URLs for NNTP newsgroup(s).