All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jia-Ju Bai <baijiaju1990@gmail.com>
To: amitkarwar@gmail.com, ganapathi017@gmail.com,
	sharvari.harisangam@nxp.com, huxinming820@gmail.com,
	kvalo@codeaurora.org, David Miller <davem@davemloft.net>,
	kuba@kernel.org
Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: [BUG] marvell: mwifiex: two possible ABBA deadlocks
Date: Tue, 23 Nov 2021 11:31:34 +0800	[thread overview]
Message-ID: <0e495b14-efbb-e0da-37bd-af6bd677ee2c@gmail.com> (raw)

Hello,

My static analysis tool reports two possible ABBA deadlocks in the 
mwifiex driver in Linux 5.10:

# DEADLOCK 1:
mwifiex_dequeue_tx_packet()
   spin_lock_bh(&priv->wmm.ra_list_spinlock); --> Line 1432 (Lock A)
   mwifiex_send_addba()
     spin_lock_bh(&priv->sta_list_spinlock); --> Line 608 (Lock B)

mwifiex_process_sta_tx_pause()
   spin_lock_bh(&priv->sta_list_spinlock); --> Line 398 (Lock B)
   mwifiex_update_ralist_tx_pause()
     spin_lock_bh(&priv->wmm.ra_list_spinlock); --> Line 941 (Lock A)

When mwifiex_dequeue_tx_packet() and mwifiex_process_sta_tx_pause() are 
concurrently executed, the deadlock can occur.

# DEADLOCK 2:
mwifiex_dequeue_tx_packet()
   spin_lock_bh(&priv->wmm.ra_list_spinlock); --> Line 1432 (Lock A)
   mwifiex_send_addba()
     spin_lock_bh(&priv->sta_list_spinlock); --> Line 608 (Lock B)

mwifiex_process_uap_tx_pause()
   spin_lock_bh(&priv->sta_list_spinlock); --> Line 363 (Lock B)
   mwifiex_update_ralist_tx_pause()
     spin_lock_bh(&priv->wmm.ra_list_spinlock); --> Line 941 (Lock A)

When mwifiex_dequeue_tx_packet() and mwifiex_process_uap_tx_pause() are 
concurrently executed, the deadlock can occur.

I am not quite sure whether these possible deadlocks are real and how to 
fix them if they are 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  3:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-23  3:31 Jia-Ju Bai [this message]
2021-11-30  0:47 ` [PATCH] mwifiex: Fix possible ABBA deadlock Brian Norris
2021-11-30  2:18   ` Jia-Ju Bai
2021-12-01 21:09   ` Doug Anderson
2021-12-08 18:37   ` Kalle Valo
2021-12-08 18:38   ` Kalle Valo

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=0e495b14-efbb-e0da-37bd-af6bd677ee2c@gmail.com \
    --to=baijiaju1990@gmail.com \
    --cc=amitkarwar@gmail.com \
    --cc=davem@davemloft.net \
    --cc=ganapathi017@gmail.com \
    --cc=huxinming820@gmail.com \
    --cc=kuba@kernel.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sharvari.harisangam@nxp.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.