[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20191219064551.stdx4aoyhwsbqbjj@isilmar-4.linta.de>
Date: Thu, 19 Dec 2019 07:45:51 +0100
From: Dominik Brodowski <linux@...inikbrodowski.net>
To: Jia-Ju Bai <baijiaju1990@...il.com>
Cc: miquel.raynal@...tlin.com, richard@....at, vigneshr@...com,
linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] mtd: maps: pcmciamtd: fix possible
sleep-in-atomic-context bugs in pcmciamtd_set_vpp()
On Thu, Dec 19, 2019 at 11:20:23AM +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.
>
> To fix these bugs, the spinlock is replaced with a mutex.
>
> These bugs are found by a static analysis tool STCheck written by
> myself.
>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@...il.com>
Reviewed-by: Dominik Brodowski <linux@...inikbrodowski.net>
I presume this will go upstream (with CC to stable -- likely applies to all
longterm kernels still maintained) via MTD? Or should I route it via pcmcia?
Thanks,
Dominik
Powered by blists - more mailing lists