linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Alexandre Courbot <acourbot@nvidia.com>
Cc: "linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	ldv-project@linuxtesting.org,
	Alexandre Courbot <gnurou@gmail.com>,
	Alexey Khoroshilov <khoroshilov@ispras.ru>,
	Andreas Larsson <andreas@gaisler.com>
Subject: Re: [PATCH] gpio/grgpio: fix deadlock in grgpio_irq_unmap()
Date: Mon, 17 Aug 2015 10:56:18 +0200	[thread overview]
Message-ID: <CACRpkdbWd70EM0azZhhmi9nyi6D1QHAWXqHkh5r-PRsmvzKXKQ@mail.gmail.com> (raw)
In-Reply-To: <1439799832-13402-1-git-send-email-acourbot@nvidia.com>

On Mon, Aug 17, 2015 at 10:23 AM, Alexandre Courbot <acourbot@nvidia.com> wrote:

> As reported by Alexey Khoroshilov:
>
>     grgpio_irq_unmap() code looks quite suspicious regarding usage of
>     priv->bgc.lock spinlock.
>
>     It locks the spinlock in line 310:
>
>         spin_lock_irqsave(&priv->bgc.lock, flags);
>
>     and then it can call grgpio_set_imask() in line 317:
>
>         grgpio_set_imask(priv, i, 0);
>
>     But grgpio_set_imask() unconditionally locks the spinlock by itself.
>
> Fix this by moving the spinlock acquisition outside of
> grgpio_set_imask().
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Reported-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
> CC: Alexey Khoroshilov <khoroshilov@ispras.ru>
> CC: Andreas Larsson <andreas@gaisler.com>

Patch applied.

Yours,
Linus Walleij

      reply	other threads:[~2015-08-17  8:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-17  8:23 [PATCH] gpio/grgpio: fix deadlock in grgpio_irq_unmap() Alexandre Courbot
2015-08-17  8:56 ` Linus Walleij [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=CACRpkdbWd70EM0azZhhmi9nyi6D1QHAWXqHkh5r-PRsmvzKXKQ@mail.gmail.com \
    --to=linus.walleij@linaro.org \
    --cc=acourbot@nvidia.com \
    --cc=andreas@gaisler.com \
    --cc=gnurou@gmail.com \
    --cc=khoroshilov@ispras.ru \
    --cc=ldv-project@linuxtesting.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).