diff options
author | Jean Delvare <khali@linux-fr.org> | 2007-11-15 13:24:03 -0500 |
---|---|---|
committer | Jean Delvare <khali@hyperion.delvare> | 2007-11-15 13:24:03 -0500 |
commit | 0f2cbd38aa377e30df3b7602abed69464d1970aa (patch) | |
tree | 8002385cdbedf5462b46b33d9a6310a7218c2961 /drivers/i2c | |
parent | be8a1f7cd4501c3b4b32543577a33aee6d2193ac (diff) |
i2c/eeprom: Hide Sony Vaio serial numbers
The sysfs interface to DMI data takes care to not make the system
serial number and UUID world-readable, presumably due to privacy
concerns. For consistency, we should not let the eeprom driver
export these same strings to the world on Sony Vaio laptops.
Instead, only make them readable by root, as we already do for BIOS
passwords.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/chips/eeprom.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c index d3da1fb05b9b..ef8a754db1db 100644 --- a/drivers/i2c/chips/eeprom.c +++ b/drivers/i2c/chips/eeprom.c | |||
@@ -128,13 +128,20 @@ static ssize_t eeprom_read(struct kobject *kobj, struct bin_attribute *bin_attr, | |||
128 | for (slice = off >> 5; slice <= (off + count - 1) >> 5; slice++) | 128 | for (slice = off >> 5; slice <= (off + count - 1) >> 5; slice++) |
129 | eeprom_update_client(client, slice); | 129 | eeprom_update_client(client, slice); |
130 | 130 | ||
131 | /* Hide Vaio security settings to regular users (16 first bytes) */ | 131 | /* Hide Vaio private settings to regular users: |
132 | if (data->nature == VAIO && off < 16 && !capable(CAP_SYS_ADMIN)) { | 132 | - BIOS passwords: bytes 0x00 to 0x0f |
133 | size_t in_row1 = 16 - off; | 133 | - UUID: bytes 0x10 to 0x1f |
134 | in_row1 = min(in_row1, count); | 134 | - Serial number: 0xc0 to 0xdf */ |
135 | memset(buf, 0, in_row1); | 135 | if (data->nature == VAIO && !capable(CAP_SYS_ADMIN)) { |
136 | if (count - in_row1 > 0) | 136 | int i; |
137 | memcpy(buf + in_row1, &data->data[16], count - in_row1); | 137 | |
138 | for (i = 0; i < count; i++) { | ||
139 | if ((off + i <= 0x1f) || | ||
140 | (off + i >= 0xc0 && off + i <= 0xdf)) | ||
141 | buf[i] = 0; | ||
142 | else | ||
143 | buf[i] = data->data[off + i]; | ||
144 | } | ||
138 | } else { | 145 | } else { |
139 | memcpy(buf, &data->data[off], count); | 146 | memcpy(buf, &data->data[off], count); |
140 | } | 147 | } |
@@ -204,7 +211,7 @@ static int eeprom_detect(struct i2c_adapter *adapter, int address, int kind) | |||
204 | && i2c_smbus_read_byte(new_client) == 'G' | 211 | && i2c_smbus_read_byte(new_client) == 'G' |
205 | && i2c_smbus_read_byte(new_client) == '-') { | 212 | && i2c_smbus_read_byte(new_client) == '-') { |
206 | dev_info(&new_client->dev, "Vaio EEPROM detected, " | 213 | dev_info(&new_client->dev, "Vaio EEPROM detected, " |
207 | "enabling password protection\n"); | 214 | "enabling privacy protection\n"); |
208 | data->nature = VAIO; | 215 | data->nature = VAIO; |
209 | } | 216 | } |
210 | } | 217 | } |