]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/2.6.22.14/i2c-eeprom-recognize-vgn-as-a-valid-sony-vaio-name-prefix.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.22.14 / i2c-eeprom-recognize-vgn-as-a-valid-sony-vaio-name-prefix.patch
CommitLineData
6cf1317f
GKH
1From khali@linux-fr.org Mon Nov 19 09:46:02 2007
2From: Jean Delvare <khali@linux-fr.org>
3Date: Fri, 16 Nov 2007 10:37:55 +0100
4Subject: i2c/eeprom: Recognize VGN as a valid Sony Vaio name prefix
5To: stable@kernel.org
6Message-ID: <20071116103755.218494f2@hyperion.delvare>
7
8From: Jean Delvare <khali@linux-fr.org>
9
10patch 8b925a3dd8a4d7451092cb9aa11da727ba69e0f0 in mainline.
11
12Recent (i.e. 2005 and later) Sony Vaio laptops have names beginning
13with VGN rather than PCG. Update the eeprom driver so that it
14recognizes these.
15
16Why this matters: the eeprom driver hides private data from the
17EEPROMs it recognizes as Vaio EEPROMs (passwords, serial number...) so
18if the driver fails to recognize a Vaio EEPROM as such, the private
19data is exposed to the world.
20
21Signed-off-by: Jean Delvare <khali@linux-fr.org>
22Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
23
24---
25 drivers/i2c/chips/eeprom.c | 14 +++++++++-----
26 1 file changed, 9 insertions(+), 5 deletions(-)
27
28--- a/drivers/i2c/chips/eeprom.c
29+++ b/drivers/i2c/chips/eeprom.c
30@@ -202,12 +202,16 @@ static int eeprom_detect(struct i2c_adap
31 goto exit_kfree;
32
33 /* Detect the Vaio nature of EEPROMs.
34- We use the "PCG-" prefix as the signature. */
35+ We use the "PCG-" or "VGN-" prefix as the signature. */
36 if (address == 0x57) {
37- if (i2c_smbus_read_byte_data(new_client, 0x80) == 'P'
38- && i2c_smbus_read_byte(new_client) == 'C'
39- && i2c_smbus_read_byte(new_client) == 'G'
40- && i2c_smbus_read_byte(new_client) == '-') {
41+ char name[4];
42+
43+ name[0] = i2c_smbus_read_byte_data(new_client, 0x80);
44+ name[1] = i2c_smbus_read_byte(new_client);
45+ name[2] = i2c_smbus_read_byte(new_client);
46+ name[3] = i2c_smbus_read_byte(new_client);
47+
48+ if (!memcmp(name, "PCG-", 4) || !memcmp(name, "VGN-", 4)) {
49 dev_info(&new_client->dev, "Vaio EEPROM detected, "
50 "enabling privacy protection\n");
51 data->nature = VAIO;