public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Michael Büsch" <m@bues.ch>
To: Jia-Ju Bai <baijiaju1990@163.com>
Cc: gregkh@linuxfoundation.org, sudipm.mukherjee@gmail.com,
	akpm@linux-foundation.org, johannes@sipsolutions.net,
	dahinds@users.sourceforge.net, linux-pcmcia@lists.infradead.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-wireless@vger.kernel.org
Subject: Re: [BUG] ssb: Possible sleep-in-atomic bugs in ssb_pcmcia_read8
Date: Sat, 21 Oct 2017 11:09:43 +0200	[thread overview]
Message-ID: <20171021110943.0e4f3a24@wiggum> (raw)
In-Reply-To: <b3252056-573d-2c69-81d6-dde291246748@163.com>

[-- Attachment #1: Type: text/plain, Size: 1287 bytes --]

On Mon, 9 Oct 2017 09:29:17 +0800
Jia-Ju Bai <baijiaju1990@163.com> wrote:

> According to pcmcia.c, the driver may sleep under a spinlock.
> The function call paths are:
> ssb_pcmcia_read8 (acquire the spinlock)
>    select_core_and_segment
>      ssb_pcmcia_switch_segment
>        ssb_pcmcia_cfg_write
>          pcmcia_write_config_byte
>            pcmcia_access_config (drivers/pcmcia/pcmcia_resource.c)
>              mutex_lock --> may sleep
> 
> ssb_pcmcia_read8 (acquire the spinlock)
>    select_core_and_segment
>      ssb_pcmcia_switch_segment
>        sssb_pcmcia_cfg_read
>          pcmcia_read_config_byte
>            pcmcia_access_config (drivers/pcmcia/pcmcia_resource.c)
>              mutex_lock --> may sleep
> 
> A possible fix is to use spinlock instead of mutex lock in 
> pcmcia_access_config in drivers/pcmcia/pcmcia_resource.c.
> 
> These bugs are found by my static analysis tool and my code review.



Thanks for scanning and your resulting bug notification.
I currently don't have the hardware at hand to develop and test a
proper fix for this.
That said, I'm not so sure anymore why bar_lock is a spinlock instead
of a mutex. It might be possible to convert this to mutex.

I will try to look into this.

-- 
Michael

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2017-10-21  9:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-09  1:29 [BUG] ssb: Possible sleep-in-atomic bugs in ssb_pcmcia_read8 Jia-Ju Bai
2017-10-21  9:09 ` Michael Büsch [this message]

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=20171021110943.0e4f3a24@wiggum \
    --to=m@bues.ch \
    --cc=akpm@linux-foundation.org \
    --cc=baijiaju1990@163.com \
    --cc=dahinds@users.sourceforge.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pcmcia@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=sudipm.mukherjee@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