Received: by 10.213.65.68 with SMTP id h4csp466118imn; Tue, 13 Mar 2018 09:57:07 -0700 (PDT) X-Google-Smtp-Source: AG47ELvBByoLC3t/l2cmUvIsvw4VEWHxG6r51dR8nw7UT3RKVVE2xDlwzUKblQNoXqRPOibxYv2a X-Received: by 10.98.157.199 with SMTP id a68mr1255253pfk.59.1520960227576; Tue, 13 Mar 2018 09:57:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520960227; cv=none; d=google.com; s=arc-20160816; b=w+/VtMVhaY4+/yt+70BlDcXs4geDwEavYU2QKSbKqv4XxuVXgv1Zl21Kj5n8UxU6lD CaEkI6LrUcOjt26rtlJL9iu8/ZMwU9zrQEkCVH6HAFm3XGfmWWdDr2NgQ77TtPc36JvF 2vX1bIrCJ40tdqRJMxZ7MybsOX1EwOFz2+YbeKs7sW7EzEEXdHph637oJZQD5B6Vfr6y OLMHMOFUnCERgRcbMzqOBbyE3Y9lGmL4HO2552qzn98JTNbMjHsqPwd7bYYHfrW1H/xb tpVh7fVY9hbLwr7hakI8hHNHc3SVkDCyN3Cq0N7cMOl/wF09kRkJ3baEytJEon1Rds6L QNyA== 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=W9HGKjYW3mxWXZJHbACv5ROvJzGPJwABocFNF0lPmjM=; b=PKY6JJbVQH0poXKS6RQZd1Ml96CDVgSs+Qov7mymt3ICeH9mc8eWpASnVBiocZqF01 uIL7xG2NDB4G9bf7gv50O5zndV9ZmK8o6x+gP/aX59lS35CrqRg4nprzKI8bOqE7WAst JqgSsXVq7EPEg8XTs92WSidi1Cw8TMpLNQdGDFrToaLos++NKbrfTRkxFyqutfRZKFSK 9gwT+JEAhzxhJfD0pXgCF7+FAtbBQLF+I/1s7f9HNESx2IU9cCGWSApTYzbC4b3hg/wC SMymflaU8IiG8Rlk9jTKLsfXlKedD3bxN4JAGFMfariCmVnSoifQu2d2e2Or+MEBTZ8V vpbg== 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 g2-v6si294453plo.567.2018.03.13.09.56.53; Tue, 13 Mar 2018 09:57:07 -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 S933255AbeCMQzU (ORCPT + 99 others); Tue, 13 Mar 2018 12:55:20 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58776 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752249AbeCMPaW (ORCPT ); Tue, 13 Mar 2018 11:30:22 -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 71AD9504; Tue, 13 Mar 2018 15:30:21 +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.15 044/146] Input: matrix_keypad - fix race when disabling interrupts Date: Tue, 13 Mar 2018 16:23:31 +0100 Message-Id: <20180313152323.992035956@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180313152320.439085687@linuxfoundation.org> References: <20180313152320.439085687@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.15-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;