* [BUG] ssb: Possible sleep-in-atomic bugs in ssb_pcmcia_read8
@ 2017-10-09 1:29 Jia-Ju Bai
2017-10-21 9:09 ` Michael Büsch
0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2017-10-09 1:29 UTC (permalink / raw)
To: gregkh, m, sudipm.mukherjee, akpm, johannes, dahinds
Cc: linux-pcmcia, Linux Kernel Mailing List, linux-wireless
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,
Jia-Ju Bai
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [BUG] ssb: Possible sleep-in-atomic bugs in ssb_pcmcia_read8
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
0 siblings, 0 replies; 2+ messages in thread
From: Michael Büsch @ 2017-10-21 9:09 UTC (permalink / raw)
To: Jia-Ju Bai
Cc: gregkh, sudipm.mukherjee, akpm, johannes, dahinds, linux-pcmcia,
Linux Kernel Mailing List, linux-wireless
[-- 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 --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-10-21 9:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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.