linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: bugzilla-daemon@kernel.org
To: linux-bluetooth@vger.kernel.org
Subject: [Bug 215746] New: rfcomm: WARNING: possible circular locking dependency detected: rfcomm_sk_state_change <-> rfcomm_run
Date: Sat, 26 Mar 2022 13:55:04 +0000	[thread overview]
Message-ID: <bug-215746-62941@https.bugzilla.kernel.org/> (raw)

https://bugzilla.kernel.org/show_bug.cgi?id=215746

            Bug ID: 215746
           Summary: rfcomm: WARNING: possible circular locking dependency
                    detected: rfcomm_sk_state_change <-> rfcomm_run
           Product: Drivers
           Version: 2.5
    Kernel Version: 5.17
          Hardware: All
                OS: Linux
              Tree: Mainline
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Bluetooth
          Assignee: linux-bluetooth@vger.kernel.org
          Reporter: travneff@gmail.com
        Regression: No

Created attachment 300617
  --> https://bugzilla.kernel.org/attachment.cgi?id=300617&action=edit
my changes on 5.17

I have this kernel trace often while connecting bluetooth headphones:

     WARNING: possible circular locking dependency detected
     5.17.0+ #1 Tainted: G        W        
     ------------------------------------------------------
     krfcommd/2671 is trying to acquire lock:
     ffff9c11062c7940 (sk_lock-AF_BLUETOOTH-BTPROTO_RFCOMM){+.+.}-{0:0}, at:
rfcomm_sk_state_change+0x4d/0x120 [rfcomm]

     but task is already holding lock:
     ffff9c10a0360f40 (&d->lock){+.+.}-{3:3}, at: rfcomm_run+0x1342/0x1860
[rfcomm]

     which lock already depends on the new lock.


     the existing dependency chain (in reverse order) is:

     -> #2 (&d->lock){+.+.}-{3:3}:
            __mutex_lock+0x93/0x840
            rfcomm_run+0x1342/0x1860 [rfcomm]
            kthread+0xf5/0x120
            ret_from_fork+0x22/0x30

     -> #1 (rfcomm_mutex){+.+.}-{3:3}:
            __mutex_lock+0x93/0x840
            rfcomm_dlc_open+0x30/0x340 [rfcomm]
            rfcomm_sock_connect+0xd5/0x130 [rfcomm]
            __sys_connect+0xb9/0xe0
            __x64_sys_connect+0x14/0x20
            do_syscall_64+0x3a/0x80
            entry_SYSCALL_64_after_hwframe+0x44/0xae

     -> #0 (sk_lock-AF_BLUETOOTH-BTPROTO_RFCOMM){+.+.}-{0:0}:
            __lock_acquire+0x1429/0x2410
            lock_acquire+0xc3/0x2c0
            lock_sock_nested+0x2e/0x80
            rfcomm_sk_state_change+0x4d/0x120 [rfcomm]
            rfcomm_run+0x135e/0x1860 [rfcomm]
            kthread+0xf5/0x120
            ret_from_fork+0x22/0x30

     other info that might help us debug this:

     Chain exists of:
       sk_lock-AF_BLUETOOTH-BTPROTO_RFCOMM --> rfcomm_mutex --> &d->lock

      Possible unsafe locking scenario:

            CPU0                    CPU1
            ----                    ----
       lock(&d->lock);
                                    lock(rfcomm_mutex);
                                    lock(&d->lock);
       lock(sk_lock-AF_BLUETOOTH-BTPROTO_RFCOMM);

      *** DEADLOCK ***

     2 locks held by krfcommd/2671:
      #0: ffffffffc0acf130 (rfcomm_mutex){+.+.}-{3:3}, at:
rfcomm_run+0x135/0x1860 [rfcomm]
      #1: ffff9c10a0360f40 (&d->lock){+.+.}-{3:3}, at: rfcomm_run+0x1342/0x1860
[rfcomm]

     stack backtrace:
     CPU: 5 PID: 2671 Comm: krfcommd Tainted: G        W         5.17.0+ #1
     Hardware name: ASUS System Product Name/TUF GAMING B550M-PLUS, BIOS 2423
08/10/2021
     Call Trace:
      <TASK>
      dump_stack_lvl+0x4c/0x60
      check_noncircular+0xe0/0x100
      __lock_acquire+0x1429/0x2410
      lock_acquire+0xc3/0x2c0
      ? rfcomm_sk_state_change+0x4d/0x120 [rfcomm]
      ? rfcomm_run+0x1342/0x1860 [rfcomm]
      lock_sock_nested+0x2e/0x80
      ? rfcomm_sk_state_change+0x4d/0x120 [rfcomm]
      rfcomm_sk_state_change+0x4d/0x120 [rfcomm]
      rfcomm_run+0x135e/0x1860 [rfcomm]
      ? __init_waitqueue_head+0x60/0x60
      ? _raw_spin_unlock_irqrestore+0x3b/0x60
      ? rfcomm_check_accept+0xa0/0xa0 [rfcomm]
      kthread+0xf5/0x120
      ? kthread_complete_and_exit+0x20/0x20
      ret_from_fork+0x22/0x30
      </TASK>

Kernel is tainted because of another bug:
https://bugzilla.kernel.org/show_bug.cgi?id=215740

BT hardware: ID 0b05:17cb ASUSTek Computer, Inc. Broadcom BCM20702A0 Bluetooth

Kernel is built from
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
at v5.17 tag (f443e374ae131c168a065ea1748feac6b2e76613)
with couple of simple changes, adding them here just in case.

Also reproduces for my distro kernel:
https://bugzilla.redhat.com/show_bug.cgi?id=1948294

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are the assignee for the bug.

             reply	other threads:[~2022-03-26 13:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-26 13:55 bugzilla-daemon [this message]
2022-03-26 13:55 ` [Bug 215746] rfcomm: WARNING: possible circular locking dependency detected: rfcomm_sk_state_change <-> rfcomm_run bugzilla-daemon

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=bug-215746-62941@https.bugzilla.kernel.org/ \
    --to=bugzilla-daemon@kernel.org \
    --cc=linux-bluetooth@vger.kernel.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).