lkml.org 
[lkml]   [2020]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 1/2 v2] gpio: gpio-grgpio: fix possible sleep-in-atomic-context bugs in grgpio_remove()
On Thu, Dec 19, 2019 at 2:15 PM Jia-Ju Bai <baijiaju1990@gmail.com> wrote:

> drivers/gpio/gpiolib-sysfs.c, 796:
> mutex_lock in gpiochip_sysfs_unregister
> drivers/gpio/gpiolib.c, 1455:
> gpiochip_sysfs_unregister in gpiochip_remove
> drivers/gpio/gpio-grgpio.c, 460:
> gpiochip_remove in grgpio_remove
> drivers/gpio/gpio-grgpio.c, 449:
> _raw_spin_lock_irqsave in grgpio_remove
>
> kernel/irq/irqdomain.c, 243:
> mutex_lock in irq_domain_remove
> drivers/gpio/gpio-grgpio.c, 463:
> irq_domain_remove in grgpio_remove
> drivers/gpio/gpio-grgpio.c, 449:
> _raw_spin_lock_irqsave in grgpio_remove
>
> mutex_lock() can sleep at runtime.
>
> To fix these bugs, the lock is dropped in grgpio_remove(), because there
> is no need for locking in remove() callbacks.
>
> These bugs are found by a static analysis tool STCheck written by
> myself.
>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
> ---
> v2:
> * Drop the lock instead of moving the calls to lock functions.
> Thank Bartosz for good advice.

Looks good to me, patch applied!

Yours,
Linus Walleij

\
 
 \ /
  Last update: 2020-01-07 10:00    [W:0.033 / U:12.744 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site