linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Pavel Skripkin <paskripkin@gmail.com>
Cc: Larry.Finger@lwfinger.net, phil@philpotter.co.uk,
	straube.linux@gmail.com, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org,
	"Fabio M . De Francesco" <fmdefrancesco@gmail.com>
Subject: Re: [PATCH] staging: r8188eu: remove _rtw_mutex_{init,free}
Date: Sat, 4 Sep 2021 09:34:08 +0200	[thread overview]
Message-ID: <YTMhcMSqWCepQMMT@kroah.com> (raw)
In-Reply-To: <20210903193356.31927-1-paskripkin@gmail.com>

On Fri, Sep 03, 2021 at 10:33:56PM +0300, Pavel Skripkin wrote:
> While testing Fabio's patch I hit lockdep warning about possible
> deadlock:
> 
> [  252.063305] WARNING: possible recursive locking detected
> [  252.063642] 5.14.0+ #9 Tainted: G         C
> [  252.063946] --------------------------------------------
> [  252.064282] ip/335 is trying to acquire lock:
> [  252.064560] ffff888009ebad28 (pmutex){+.+.}-{4:4}, at: usbctrl_vendorreq+0xc5/0x4a0 [r8188eu]
> [  252.065168]
> [  252.065168] but task is already holding lock:
> [  252.065536] ffffffffc021b3b8 (pmutex){+.+.}-{4:4}, at:  netdev_open+0x3a/0x5f [r8188eu]
> [  252.066085]
> [  252.066085] other info that might help us debug this:
> [  252.066494]  Possible unsafe locking scenario:
> [  252.066494]
> [  252.066866]        CPU0
> [  252.067025]        ----
> [  252.067184]   lock(pmutex);
> [  252.067367]   lock(pmutex);
> 
> There is one problem with this warning: there is no pmutex in this
> driver, *BUT* all mutexes are initialized via private _rtw_mutex_init
> API, which had struct mutex *pmutex argument.
> 
> So, all mutexes in this driver had same name in lockdep map. Of course,
> lockdep will complain about any nested locking.
> 
> Fix it by open-coding _rtw_mutex_{init,free} wrappers, because we do not
> need them at all.
> 
> Cc: Fabio M. De Francesco <fmdefrancesco@gmail.com>
> Fixes: 15865124feed ("staging: r8188eu: introduce new core dir for RTL8188eu driver")

No need for "Fixes:" on this, as it's not a bug, it's just a badly
designed implementation.

thanks,

greg k-h

  reply	other threads:[~2021-09-04  7:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-03 19:33 [PATCH] staging: r8188eu: remove _rtw_mutex_{init,free} Pavel Skripkin
2021-09-04  7:34 ` Greg KH [this message]
2021-09-04 12:47   ` [PATCH v2] " Pavel Skripkin

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=YTMhcMSqWCepQMMT@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=Larry.Finger@lwfinger.net \
    --cc=fmdefrancesco@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=paskripkin@gmail.com \
    --cc=phil@philpotter.co.uk \
    --cc=straube.linux@gmail.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).