From: Jia-Ju Bai <baijiaju1990@gmail.com>
To: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com,
linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mtd: maps: pcmciamtd: fix possible sleep-in-atomic-context bugs in pcmciamtd_set_vpp()
Date: Thu, 19 Dec 2019 10:32:24 +0800 [thread overview]
Message-ID: <42939a91-baab-54ad-bb4c-8a77e4418f2f@gmail.com> (raw)
In-Reply-To: <20191218172813.GA338501@light.dominikbrodowski.net>
On 2019/12/19 1:28, Dominik Brodowski wrote:
> On Wed, Dec 18, 2019 at 10:05:52PM +0800, Jia-Ju Bai wrote:
>> The driver may sleep while holding a spinlock.
>> The function call path (from bottom to top) in Linux 4.19 is:
>>
>> drivers/pcmcia/pcmcia_resource.c, 312:
>> mutex_lock in pcmcia_fixup_vpp
>> drivers/mtd/maps/pcmciamtd.c, 309:
>> pcmcia_fixup_vpp in pcmciamtd_set_vpp
>> drivers/mtd/maps/pcmciamtd.c, 306:
>> _raw_spin_lock_irqsave in pcmciamtd_set_vpp
>>
>> drivers/pcmcia/pcmcia_resource.c, 312:
>> mutex_lock in pcmcia_fixup_vpp
>> drivers/mtd/maps/pcmciamtd.c, 312:
>> pcmcia_fixup_vpp in pcmciamtd_set_vpp
>> drivers/mtd/maps/pcmciamtd.c, 306:
>> _raw_spin_lock_irqsave in pcmciamtd_set_vp
>>
>> mutex_lock() may sleep at runtime.
> Thanks for noticing this issue.
>
>> To fix these bugs, pcmcia_fixup_vpp() is called without holding the
>> spinlock.
> I don't think that this is the right approach here -- we lose the protection
> against races in calls to pcmcia_fixup_vpp(). Instead, we should change the
> spinlock to a mutex, which seems to be sufficient here. Could you prepare
> such a patch, please?
Okay, thanks for the advice :)
I will send a new patch.
Best wishes,
Jia-Ju Bai
next prev parent reply other threads:[~2019-12-19 2:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-18 14:05 Jia-Ju Bai
2019-12-18 17:28 ` Dominik Brodowski
2019-12-19 2:32 ` Jia-Ju Bai [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-12-18 13:41 Jia-Ju Bai
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=42939a91-baab-54ad-bb4c-8a77e4418f2f@gmail.com \
--to=baijiaju1990@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux@dominikbrodowski.net \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--cc=vigneshr@ti.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
Powered by JetHome