Received: by 10.213.65.68 with SMTP id h4csp433816imn; Tue, 13 Mar 2018 08:56:24 -0700 (PDT) X-Google-Smtp-Source: AG47ELu3V8Xbl3hAytuA+GaskfrB3nvmRUwM3ILJ+eS9Pefu2qe9na5zZufuylL4JWvvjhbHlCW4 X-Received: by 10.101.87.138 with SMTP id b10mr870794pgr.241.1520956584310; Tue, 13 Mar 2018 08:56:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520956584; cv=none; d=google.com; s=arc-20160816; b=l59qVeBzHw8KdxtYKbY+QeW9v85AqfXqIAl30ocHHqj0kDBQHCR7hVudDc87iW+P9R Zlm9FR54noByfKmNGZEB3xlQwGyPPwMWius/AEkcHOiwB+iFH/oyZZrBSCyYnTV2AOun xpa6q0mX8LirJwOMqE4Zyy8dpzWurUtLBXvKEra/MSH9/Cgrn7S+YGUlzGvuf2XeBIA9 P6RUa+/bGILeWER4v6nk/eRpjsZXohOopoGU5JZdC6jNCHevkj4pE+RR5Te1QsoyQkkX 4e4BicdMhwTBCNuLfg9miksRHckofA35O8fVB6S2c3ZUGUu84NKeLjSONwyX4XZOxgnj YIYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=9WndTdS7Jv44zQ3rZhI3YdzFXUQG2oMJb2JpaTOQW3I=; b=EcUsLPz/zI8WT3uZ1laeGoDUrgn/6oj9Pe5HVooE2LdAd6Hn4DE1uFtJuE8Tn52BzU MSil102f3IF2cPogdr6T7C5ACjbo0ssk6UO1pc3Ea5GYB723aiq83inw+NZC/iQN4W/3 UvkAu9N/5Ij7cw4Ga3cerwOdPOsSgcNOpuZM9aFSCNRY/9mwS0QQLOPO5EM1+8Oj9WIB UhE8zmo8YyQAKfazbPSjOkkn4sIe59+GI8ARAXvnsjr11JLHSbejRS+CRHD8loEOldOk 0O1XoEGXNw47Yv8am4AFyvpdRrGEBjbsDAnNpQ4VqT/0Kjl/MEEehhN8D1s0b9Cz8NrA YDHA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1-v6si301182plw.587.2018.03.13.08.56.09; Tue, 13 Mar 2018 08:56:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752675AbeCMPy3 (ORCPT + 99 others); Tue, 13 Mar 2018 11:54:29 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:35180 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934657AbeCMPjE (ORCPT ); Tue, 13 Mar 2018 11:39:04 -0400 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 9EFE7F8F; Tue, 13 Mar 2018 15:39:03 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Bo , Dmitry Torokhov Subject: [PATCH 4.14 082/140] Input: matrix_keypad - fix race when disabling interrupts Date: Tue, 13 Mar 2018 16:24:45 +0100 Message-Id: <20180313152503.702069224@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180313152458.201155692@linuxfoundation.org> References: <20180313152458.201155692@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zhang Bo commit ea4f7bd2aca9f68470e9aac0fc9432fd180b1fe7 upstream. If matrix_keypad_stop() is executing and the keypad interrupt is triggered, disable_row_irqs() may be called by both matrix_keypad_interrupt() and matrix_keypad_stop() at the same time, causing interrupts to be disabled twice and the keypad being "stuck" after resuming. Take lock when setting keypad->stopped to ensure that ISR will not race with matrix_keypad_stop() disabling interrupts. Signed-off-by: Zhang Bo Cc: stable@vger.kernel.org Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/keyboard/matrix_keypad.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/input/keyboard/matrix_keypad.c +++ b/drivers/input/keyboard/matrix_keypad.c @@ -218,8 +218,10 @@ static void matrix_keypad_stop(struct in { struct matrix_keypad *keypad = input_get_drvdata(dev); + spin_lock_irq(&keypad->lock); keypad->stopped = true; - mb(); + spin_unlock_irq(&keypad->lock); + flush_work(&keypad->work.work); /* * matrix_keypad_scan() will leave IRQs enabled;