Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp2310707ybg; Fri, 5 Jun 2020 10:36:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwa09Mja7SJewHItkM5lYXBT069z2YlFzRXa6HdFSWaXlDQUp8XC0aZcNCbR+aRn59aic1L X-Received: by 2002:a17:906:6897:: with SMTP id n23mr9971360ejr.437.1591378617632; Fri, 05 Jun 2020 10:36:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591378617; cv=none; d=google.com; s=arc-20160816; b=DewVxBvUFiuJepaJoQ9L4CMmt1LpyaMh2Wt1Ayb1I8EgSeBXOgPGGoMpMBRxpg6Woc c1EASmnwvWzoIBqIYfTGFddC0mzfhcBGUl3YYnfjN56bMQA/fOLwN7MvEKMvvfUt+6pJ f1iCE7ka3fWyv/dT45zIpaVtYKE5SaCD2+6oWgEPrcW4gc/SEn14zlDYU7l3tLS7qa2R ZpS7CAnmiPIVq59RXenSr6mLB3U7VHf7Sx+KvBxYZBMmbnwEaRzutIh7KMzDJezt1d1C OA/KqcQ/XaxDHjEZVpMKlQuGi5C4si/ZfKUNmgEVJCYNagB9hFJ7Zg+lX7PUCMOryGZf jJWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=DjNhaE+2rOPGV85DSu3npl83FnLyZ567RsmMJaAJ9M4=; b=zGNP/yCPAh+KIY0gCuTCk2qFibR98gLvnxlKnxPhqosJBA0pm8pFW6u6wzA/kgwbnc CAeoa9X0THllm9sB45xeZUabeXnhf2Xwm+eggVAvLFf/UWvpnnyNOErxyfOwV5Rp9FUv Pie3wPmVtkMfP3wrCqUkLnCh3Fp+qcx0Mw4yGHxzQ+7Y3VhS4nKbqSb58MES/Ti0k8e5 YwcDL+m37P2Q+18HD+hmZhXfswKiNtMCzvPxW/lifDbJ6jGXBmOl7KeH1mdVPZhErcyv q1lJSgszjlNXXBXESRCoG42FRx+ZyzhKClOp4OjxFW2P7TZsFnmhn74+7dV8ktMABH0c cawQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n9si3960059eds.80.2020.06.05.10.36.34; Fri, 05 Jun 2020 10:36:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728339AbgFERe1 (ORCPT + 99 others); Fri, 5 Jun 2020 13:34:27 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:39126 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727884AbgFERdy (ORCPT ); Fri, 5 Jun 2020 13:33:54 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: andrzej.p) with ESMTPSA id 3708F2A5080 From: Andrzej Pietrasiewicz To: linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-input@vger.kernel.org, linux-tegra@vger.kernel.org, patches@opensource.cirrus.com, ibm-acpi-devel@lists.sourceforge.net, platform-driver-x86@vger.kernel.org Cc: "Rafael J . Wysocki" , Len Brown , Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Kukjin Kim , Krzysztof Kozlowski , Dmitry Torokhov , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Vladimir Zapolskiy , Sylvain Lemieux , Laxman Dewangan , Thierry Reding , Jonathan Hunter , Barry Song , Michael Hennerich , Nick Dyer , Hans de Goede , Ferruh Yigit , Sangwon Jee , Peter Hutterer , Henrique de Moraes Holschuh , Andrzej Pietrasiewicz , kernel@collabora.com Subject: [PATCH v3 3/7] ACPI: button: Access input device's users under appropriate mutex Date: Fri, 5 Jun 2020 19:33:31 +0200 Message-Id: <20200605173335.13753-4-andrzej.p@collabora.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605173335.13753-1-andrzej.p@collabora.com> References: <20200604072853.GP89269@dtor-ws> <20200605173335.13753-1-andrzej.p@collabora.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Inspecting input device's 'users' member should be done under device's mutex, so add appropriate invocations. Signed-off-by: Andrzej Pietrasiewicz --- drivers/acpi/button.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 78cfc70cb320..ff7ab291f678 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c @@ -456,13 +456,16 @@ static int acpi_button_resume(struct device *dev) { struct acpi_device *device = to_acpi_device(dev); struct acpi_button *button = acpi_driver_data(device); + struct input_dev *input = button->input; button->suspended = false; - if (button->type == ACPI_BUTTON_TYPE_LID && button->input->users) { + mutex_lock(&input->mutex); + if (button->type == ACPI_BUTTON_TYPE_LID && input->users) { button->last_state = !!acpi_lid_evaluate_state(device); button->last_time = ktime_get(); acpi_lid_initialize_state(device); } + mutex_unlock(&input->mutex); return 0; } #endif -- 2.17.1