From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, jwboyer@fedoraproject.org,
Guenter Roeck <linux@roeck-us.net>,
Henrik Rydberg <rydberg@euromail.se>
Subject: [ 10/13] hwmon: (applesmc) Check key count before proceeding
Date: Wed, 2 Oct 2013 21:04:35 -0700 [thread overview]
Message-ID: <20131003040401.466450552@linuxfoundation.org> (raw)
In-Reply-To: <20131003040400.753642257@linuxfoundation.org>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Henrik Rydberg <rydberg@euromail.se>
commit 5f4513864304672e6ea9eac60583eeac32e679f2 upstream.
After reports from Chris and Josh Boyer of a rare crash in applesmc,
Guenter pointed at the initialization problem fixed below. The patch
has not been verified to fix the crash, but should be applied
regardless.
Reported-by: <jwboyer@fedoraproject.org>
Suggested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hwmon/applesmc.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -485,16 +485,25 @@ static int applesmc_init_smcreg_try(void
{
struct applesmc_registers *s = &smcreg;
bool left_light_sensor, right_light_sensor;
+ unsigned int count;
u8 tmp[1];
int ret;
if (s->init_complete)
return 0;
- ret = read_register_count(&s->key_count);
+ ret = read_register_count(&count);
if (ret)
return ret;
+ if (s->cache && s->key_count != count) {
+ pr_warn("key count changed from %d to %d\n",
+ s->key_count, count);
+ kfree(s->cache);
+ s->cache = NULL;
+ }
+ s->key_count = count;
+
if (!s->cache)
s->cache = kcalloc(s->key_count, sizeof(*s->cache), GFP_KERNEL);
if (!s->cache)
next prev parent reply other threads:[~2013-10-03 4:04 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-03 4:04 [ 00/13] 3.0.99-stable review Greg Kroah-Hartman
2013-10-03 4:04 ` [ 01/13] x86/reboot: Add quirk to make Dell C6100 use reboot=pci automatically Greg Kroah-Hartman
2013-10-03 4:04 ` [ 02/13] x86, efi: Dont map Boot Services on i386 Greg Kroah-Hartman
2013-10-03 4:04 ` [ 03/13] staging: vt6656: [BUG] main_usb.c oops on device_close move flag earlier Greg Kroah-Hartman
2013-10-03 4:04 ` [ 04/13] xhci: Fix oops happening after address device timeout Greg Kroah-Hartman
2013-10-03 4:04 ` [ 05/13] xhci: Fix race between ep halt and URB cancellation Greg Kroah-Hartman
2013-10-03 4:04 ` [ 06/13] usb/core/devio.c: Dont reject control message to endpoint with wrong direction bit Greg Kroah-Hartman
2013-10-03 4:04 ` [ 07/13] dm snapshot: workaround for a false positive lockdep warning Greg Kroah-Hartman
2013-10-03 4:04 ` [ 08/13] dm-snapshot: fix performance degradation due to small hash size Greg Kroah-Hartman
2013-10-03 4:04 ` [ 09/13] drm/i915/dp: increase i2c-over-aux retry interval on AUX DEFER Greg Kroah-Hartman
2013-10-03 4:04 ` Greg Kroah-Hartman [this message]
2013-10-03 4:04 ` [ 11/13] mm: fix aio performance regression for database caused by THP Greg Kroah-Hartman
2013-10-03 4:04 ` [ 12/13] hwmon: (applesmc) Silence uninitialized warnings Greg Kroah-Hartman
2013-10-03 4:04 ` [ 13/13] splice: fix racy pipe->buffers uses Greg Kroah-Hartman
2013-10-03 5:53 ` [ 00/13] 3.0.99-stable review Guenter Roeck
2013-10-03 12:47 ` Christoph Biedl
2013-10-03 13:29 ` Guenter Roeck
2013-10-03 13:35 ` Khalid Aziz
2013-10-03 14:41 ` Christoph Biedl
2013-10-03 14:56 ` Khalid Aziz
2013-10-03 15:12 ` Khalid Aziz
2013-10-03 18:34 ` Greg Kroah-Hartman
2013-10-03 19:15 ` Christoph Biedl
2013-10-03 20:03 ` Khalid Aziz
2013-10-03 15:56 ` Guenter Roeck
2013-10-03 18:40 ` Greg Kroah-Hartman
2013-10-03 21:18 ` Guenter Roeck
2013-10-03 18:36 ` Greg Kroah-Hartman
2013-10-04 0:16 ` Shuah Khan
2013-10-04 2:37 ` Greg Kroah-Hartman
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=20131003040401.466450552@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=jwboyer@fedoraproject.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=rydberg@euromail.se \
--cc=stable@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;
as well as URLs for NNTP newsgroup(s).