From: "Pali Rohár" <pali.rohar@gmail.com>
To: "Matthew Garrett" <mjg59@srcf.ucam.org>,
"Darren Hart" <dvhart@infradead.org>,
"Gabriele Mazzotta" <gabriele.mzt@gmail.com>,
"Michał Kępień" <kernel@kempniu.pl>
Cc: "Andy Lutomirski" <luto@kernel.org>,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org, "Pali Rohár" <pali.rohar@gmail.com>
Subject: [PATCH v2 2/2] dell-wmi: Process only one event on devices with interface version 0
Date: Mon, 4 Jan 2016 22:26:36 +0100 [thread overview]
Message-ID: <1451942796-26574-3-git-send-email-pali.rohar@gmail.com> (raw)
In-Reply-To: <1451942796-26574-1-git-send-email-pali.rohar@gmail.com>
BIOS/ACPI on devices with WMI interface version 0 does not clear buffer
before filling it. So next time when BIOS/ACPI send WMI event which is
smaller as previous then it contains garbage in buffer from previous event.
BIOS/ACPI on devices with WMI interface version 1 clears buffer and
sometimes send more events in buffer at one call.
Since commit 83fc44c32ad8 ("dell-wmi: Update code for processing WMI
events") dell-wmi process all events in buffer (and not just first).
So to prevent reading garbage from buffer we will process only first one
event on devices with WMI interface version 0.
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
---
drivers/platform/x86/dell-wmi.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c
index 1ad7a7b..5db9efb 100644
--- a/drivers/platform/x86/dell-wmi.c
+++ b/drivers/platform/x86/dell-wmi.c
@@ -237,6 +237,22 @@ static void dell_wmi_notify(u32 value, void *context)
buffer_end = buffer_entry + buffer_size;
+ /*
+ * BIOS/ACPI on devices with WMI interface version 0 does not clear
+ * buffer before filling it. So next time when BIOS/ACPI send WMI event
+ * which is smaller as previous then it contains garbage in buffer from
+ * previous event.
+ *
+ * BIOS/ACPI on devices with WMI interface version 1 clears buffer and
+ * sometimes send more events in buffer at one call.
+ *
+ * So to prevent reading garbage from buffer we will process only first
+ * one event on devices with WMI interface version 0.
+ */
+ if (dell_wmi_interface_version == 0 && buffer_entry < buffer_end)
+ if (buffer_end > buffer_entry + buffer_entry[0] + 1)
+ buffer_end = buffer_entry + buffer_entry[0] + 1;
+
while (buffer_entry < buffer_end) {
len = buffer_entry[0];
--
1.7.9.5
next prev parent reply other threads:[~2016-01-04 21:27 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-24 21:18 [PATCH 0/2] Fixes for dell-wmi Pali Rohár
2015-12-24 21:18 ` [PATCH 1/2] dell-wmi: Check if Dell WMI descriptor structure is valid Pali Rohár
2015-12-25 1:23 ` Andy Lutomirski
2015-12-25 13:02 ` Pali Rohár
2015-12-28 13:37 ` Michał Kępień
2015-12-28 14:08 ` Pali Rohár
2015-12-29 12:44 ` Michał Kępień
2015-12-29 16:05 ` Pali Rohár
2015-12-30 11:27 ` Michał Kępień
2016-01-04 18:23 ` Andy Lutomirski
2015-12-24 21:18 ` [PATCH 2/2] dell-wmi: Process only one event on devices with interface version 0 Pali Rohár
2015-12-28 13:40 ` Michał Kępień
2015-12-28 13:49 ` Pali Rohár
2015-12-27 12:59 ` [PATCH 0/2] Fixes for dell-wmi Gabriele Mazzotta
2015-12-27 13:07 ` Pali Rohár
2015-12-27 13:10 ` Gabriele Mazzotta
2015-12-27 13:17 ` Pali Rohár
2015-12-28 13:33 ` Michał Kępień
2015-12-28 13:46 ` Pali Rohár
2015-12-29 12:18 ` Michał Kępień
2016-01-04 20:48 ` Darren Hart
2016-01-07 22:31 ` Pali Rohár
2016-01-04 21:26 ` [PATCH v2 " Pali Rohár
2016-01-04 21:26 ` [PATCH v2 1/2] dell-wmi: Check if Dell WMI descriptor structure is valid Pali Rohár
2016-01-04 21:26 ` Pali Rohár [this message]
2016-01-12 11:14 ` [PATCH v2 2/2] dell-wmi: Process only one event on devices with interface version 0 Michał Kępień
2016-01-12 17:49 ` Pali Rohár
2016-01-12 20:12 ` Michał Kępień
2016-01-14 23:06 ` Darren Hart
2016-01-11 19:22 ` [PATCH v2 0/2] Fixes for dell-wmi Darren Hart
2016-01-12 0:30 ` Gabriele Mazzotta
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=1451942796-26574-3-git-send-email-pali.rohar@gmail.com \
--to=pali.rohar@gmail.com \
--cc=dvhart@infradead.org \
--cc=gabriele.mzt@gmail.com \
--cc=kernel@kempniu.pl \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mjg59@srcf.ucam.org \
--cc=platform-driver-x86@vger.kernel.org \
/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
all inboxes | Powered by JetHome®