Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753386AbbHQI4U (ORCPT ); Mon, 17 Aug 2015 04:56:20 -0400 Received: from mail-ob0-f181.google.com ([209.85.214.181]:33466 "EHLO mail-ob0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750754AbbHQI4T (ORCPT ); Mon, 17 Aug 2015 04:56:19 -0400 MIME-Version: 1.0 In-Reply-To: <1439799832-13402-1-git-send-email-acourbot@nvidia.com> References: <1439799832-13402-1-git-send-email-acourbot@nvidia.com> Date: Mon, 17 Aug 2015 10:56:18 +0200 Message-ID: Subject: Re: [PATCH] gpio/grgpio: fix deadlock in grgpio_irq_unmap() From: Linus Walleij To: Alexandre Courbot Cc: "linux-gpio@vger.kernel.org" , "linux-kernel@vger.kernel.org" , ldv-project@linuxtesting.org, Alexandre Courbot , Alexey Khoroshilov , Andreas Larsson Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1143 Lines: 36 On Mon, Aug 17, 2015 at 10:23 AM, Alexandre Courbot 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 > Signed-off-by: Alexandre Courbot > CC: Alexey Khoroshilov > CC: Andreas Larsson Patch applied. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/