From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Russell King <linux@armlinux.org.uk>,
Guenter Roeck <linux@roeck-us.net>,
Jean Delvare <jdelvare@suse.de>
Subject: [PATCH 4.10 4/5] hwmon: (it87) Avoid registering the same chip on both SIO addresses
Date: Sat, 6 May 2017 13:39:21 -0700 [thread overview]
Message-ID: <20170506203843.579969374@linuxfoundation.org> (raw)
In-Reply-To: <20170506203843.407624742@linuxfoundation.org>
4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <linux@roeck-us.net>
commit 8358378b22518d92424597503d3c1cd302a490b6 upstream.
IT8705F is known to respond on both SIO addresses. Registering it twice
may result in system lockups.
Reported-by: Russell King <linux@armlinux.org.uk>
Fixes: e84bd9535e2b ("hwmon: (it87) Add support for second Super-IO chip")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Cc: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hwmon/it87.c | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -3115,7 +3115,7 @@ static int __init sm_it87_init(void)
{
int sioaddr[2] = { REG_2E, REG_4E };
struct it87_sio_data sio_data;
- unsigned short isa_address;
+ unsigned short isa_address[2];
bool found = false;
int i, err;
@@ -3125,15 +3125,29 @@ static int __init sm_it87_init(void)
for (i = 0; i < ARRAY_SIZE(sioaddr); i++) {
memset(&sio_data, 0, sizeof(struct it87_sio_data));
- isa_address = 0;
- err = it87_find(sioaddr[i], &isa_address, &sio_data);
- if (err || isa_address == 0)
+ isa_address[i] = 0;
+ err = it87_find(sioaddr[i], &isa_address[i], &sio_data);
+ if (err || isa_address[i] == 0)
continue;
+ /*
+ * Don't register second chip if its ISA address matches
+ * the first chip's ISA address.
+ */
+ if (i && isa_address[i] == isa_address[0])
+ break;
- err = it87_device_add(i, isa_address, &sio_data);
+ err = it87_device_add(i, isa_address[i], &sio_data);
if (err)
goto exit_dev_unregister;
+
found = true;
+
+ /*
+ * IT8705F may respond on both SIO addresses.
+ * Stop probing after finding one.
+ */
+ if (sio_data.type == it87)
+ break;
}
if (!found) {
next prev parent reply other threads:[~2017-05-06 20:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-06 20:39 [PATCH 4.10 0/5] 4.10.15-stable review Greg Kroah-Hartman
2017-05-06 20:39 ` [PATCH 4.10 1/5] timerfd: Protect the might cancel mechanism proper Greg Kroah-Hartman
2017-05-06 20:39 ` [PATCH 4.10 2/5] Handle mismatched open calls Greg Kroah-Hartman
2017-05-06 20:39 ` [PATCH 4.10 3/5] scsi: storvsc: Workaround for virtual DVD SCSI version Greg Kroah-Hartman
2017-05-06 20:39 ` Greg Kroah-Hartman [this message]
2017-05-06 20:39 ` [PATCH 4.10 5/5] dm ioctl: prevent stack leak in dm ioctl call Greg Kroah-Hartman
2017-05-07 19:38 ` [PATCH 4.10 0/5] 4.10.15-stable review Guenter Roeck
2017-05-08 5:43 ` Greg Kroah-Hartman
2017-05-08 19:16 ` Shuah Khan
2017-05-09 7:44 ` 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=20170506203843.579969374@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=jdelvare@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linux@roeck-us.net \
--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).