From patchwork Thu Jan 14 08:41:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 8030631 Return-Path: X-Original-To: patchwork-platform-driver-x86@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 15A03BEEE5 for ; Thu, 14 Jan 2016 08:42:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4BA0520490 for ; Thu, 14 Jan 2016 08:42:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 60C962044C for ; Thu, 14 Jan 2016 08:42:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752060AbcANImD (ORCPT ); Thu, 14 Jan 2016 03:42:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58403 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751125AbcANImC (ORCPT ); Thu, 14 Jan 2016 03:42:02 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 5949819F274; Thu, 14 Jan 2016 08:42:02 +0000 (UTC) Received: from shalem.localdomain.com (vpn1-4-214.ams2.redhat.com [10.36.4.214]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0E8fpOA028469; Thu, 14 Jan 2016 03:41:57 -0500 From: Hans de Goede To: Darren Hart , Henrique de Moraes Holschuh , "Rafael J. Wysocki" Cc: platform-driver-x86@vger.kernel.org, ibm-acpi-devel@lists.sourceforge.net, Adrien Schildknecht , Zhang Rui , Len Brown , linux-acpi@vger.kernel.org, Hans de Goede Subject: [PATCH 2/4] acpi_video: Fix using an uninitialized mutex / list_head in acpi_video_handles_brightness_key_presses() Date: Thu, 14 Jan 2016 09:41:46 +0100 Message-Id: <1452760908-15965-2-git-send-email-hdegoede@redhat.com> In-Reply-To: <1452760908-15965-1-git-send-email-hdegoede@redhat.com> References: <1452760908-15965-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If acpi_video_handles_brightness_key_presses() was called before acpi_video_register(), it would use the video_list mutex / list_head uninitialized. This patch fixes this by using DEFINE_MUTEX / LIST_HEAD when declaring these, instead of initializing them runtime from acpi_video_register(). Signed-off-by: Hans de Goede --- drivers/acpi/acpi_video.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c index d95aaa5..408b014 100644 --- a/drivers/acpi/acpi_video.c +++ b/drivers/acpi/acpi_video.c @@ -92,8 +92,8 @@ module_param(only_lcd, bool, 0444); static int register_count; static DEFINE_MUTEX(register_count_mutex); -static struct mutex video_list_lock; -static struct list_head video_bus_head; +static DEFINE_MUTEX(video_list_lock); +static LIST_HEAD(video_bus_head); static int acpi_video_bus_add(struct acpi_device *device); static int acpi_video_bus_remove(struct acpi_device *device); static void acpi_video_bus_notify(struct acpi_device *device, u32 event); @@ -2067,9 +2067,6 @@ int acpi_video_register(void) goto leave; } - mutex_init(&video_list_lock); - INIT_LIST_HEAD(&video_bus_head); - dmi_check_system(video_dmi_table); ret = acpi_bus_register_driver(&acpi_video_bus);