linux-fpga.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jia-Ju Bai <baijiaju1990@gmail.com>
To: hao.wu@intel.com, trix@redhat.com, mdf@kernel.org
Cc: linux-fpga@vger.kernel.org, linux-kernel <linux-kernel@vger.kernel.org>
Subject: [BUG] fpga: dfl: possible ABBA deadlock in dfl_fpga_cdev_assign_port() and fme_pr()
Date: Tue, 23 Nov 2021 15:55:16 +0800	[thread overview]
Message-ID: <9460c1ba-addd-9757-fe55-ceeeae596ac1@gmail.com> (raw)

Hello,

My static analysis tool reports a possible ABBA deadlock in the dfl 
driver in Linux 5.10:

dfl_fpga_cdev_assign_port()
   mutex_lock(&cdev->lock); --> Line 1067 (Lock A)
   mutex_lock(&pdata->lock); --> Line 1624 (Lock B)

fme_pr()
   mutex_lock(&pdata->lock); --> Line 126 (Lock B)
   fpga_region_program_fpga()
     fpga_bridges_enable()
       fpga_bridge_enable()
         fme_bridge_enable_set() --> function pointer via 
"bridge->br_ops->enable_set()"
           dfl_fpga_cdev_find_port()
             mutex_lock(&cdev->lock); --> Line 499 (LockA)

When dfl_fpga_cdev_assign_port() and fme_pr() are concurrently executed, 
the deadlock can occur.

I am not quite sure whether this possible deadlock is real and how to 
fix it if it is real.
Any feedback would be appreciated, thanks

Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>


Best wishes,
Jia-Ju Bai

             reply	other threads:[~2021-11-23  7:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-23  7:55 Jia-Ju Bai [this message]
2021-11-24 15:59 ` [BUG] fpga: dfl: possible ABBA deadlock in dfl_fpga_cdev_assign_port() and fme_pr() Wu, Hao

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=9460c1ba-addd-9757-fe55-ceeeae596ac1@gmail.com \
    --to=baijiaju1990@gmail.com \
    --cc=hao.wu@intel.com \
    --cc=linux-fpga@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mdf@kernel.org \
    --cc=trix@redhat.com \
    /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).