From: Hans de Goede <hdegoede@redhat.com>
To: Darren Hart <dvhart@infradead.org>,
Henrique de Moraes Holschuh <ibm-acpi@hmh.eng.br>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: platform-driver-x86@vger.kernel.org,
ibm-acpi-devel@lists.sourceforge.net,
Adrien Schildknecht <adrien+dev@schischi.me>,
Zhang Rui <rui.zhang@intel.com>, Len Brown <lenb@kernel.org>,
linux-acpi@vger.kernel.org, Hans de Goede <hdegoede@redhat.com>
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 [thread overview]
Message-ID: <1452760908-15965-2-git-send-email-hdegoede@redhat.com> (raw)
In-Reply-To: <1452760908-15965-1-git-send-email-hdegoede@redhat.com>
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 <hdegoede@redhat.com>
---
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);
--
2.5.0
next prev parent reply other threads:[~2016-01-14 8:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-14 8:41 [PATCH 1/4] acpi_video: Revert "ACPI / video: driver must be registered before checking for keypresses" Hans de Goede
2016-01-14 8:41 ` Hans de Goede [this message]
2016-01-14 8:41 ` [PATCH 3/4] acpi_video: Document acpi_video_handles_brightness_key_presses() a bit Hans de Goede
2016-01-14 8:41 ` [PATCH 4/4] Revert "thinkpad_acpi: Use acpi_video_handles_brightness_key_presses()" Hans de Goede
2016-01-14 23:18 ` Darren Hart
[not found] ` <20160114231856.GA20294-Z5kFBHtJu+EzCVHREhWfF0EOCMrvLtNR@public.gmane.org>
2016-01-15 0:15 ` Henrique de Moraes Holschuh
2016-01-15 0:52 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1452760908-15965-2-git-send-email-hdegoede@redhat.com \
--to=hdegoede@redhat.com \
--cc=adrien+dev@schischi.me \
--cc=dvhart@infradead.org \
--cc=ibm-acpi-devel@lists.sourceforge.net \
--cc=ibm-acpi@hmh.eng.br \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=rui.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox