]>
Commit | Line | Data |
---|---|---|
6cf1317f GKH |
1 | From khali@linux-fr.org Mon Nov 19 09:46:02 2007 |
2 | From: Jean Delvare <khali@linux-fr.org> | |
3 | Date: Fri, 16 Nov 2007 10:37:55 +0100 | |
4 | Subject: i2c/eeprom: Recognize VGN as a valid Sony Vaio name prefix | |
5 | To: stable@kernel.org | |
6 | Message-ID: <20071116103755.218494f2@hyperion.delvare> | |
7 | ||
8 | From: Jean Delvare <khali@linux-fr.org> | |
9 | ||
10 | patch 8b925a3dd8a4d7451092cb9aa11da727ba69e0f0 in mainline. | |
11 | ||
12 | Recent (i.e. 2005 and later) Sony Vaio laptops have names beginning | |
13 | with VGN rather than PCG. Update the eeprom driver so that it | |
14 | recognizes these. | |
15 | ||
16 | Why this matters: the eeprom driver hides private data from the | |
17 | EEPROMs it recognizes as Vaio EEPROMs (passwords, serial number...) so | |
18 | if the driver fails to recognize a Vaio EEPROM as such, the private | |
19 | data is exposed to the world. | |
20 | ||
21 | Signed-off-by: Jean Delvare <khali@linux-fr.org> | |
22 | Signed-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; |