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>
This commit is contained in:
parent
be8a1f7cd4
commit
0f2cbd38aa
|
@ -128,13 +128,20 @@ static ssize_t eeprom_read(struct kobject *kobj, struct bin_attribute *bin_attr,
|
||||||
for (slice = off >> 5; slice <= (off + count - 1) >> 5; slice++)
|
for (slice = off >> 5; slice <= (off + count - 1) >> 5; slice++)
|
||||||
eeprom_update_client(client, slice);
|
eeprom_update_client(client, slice);
|
||||||
|
|
||||||
/* Hide Vaio security settings to regular users (16 first bytes) */
|
/* Hide Vaio private settings to regular users:
|
||||||
if (data->nature == VAIO && off < 16 && !capable(CAP_SYS_ADMIN)) {
|
- BIOS passwords: bytes 0x00 to 0x0f
|
||||||
size_t in_row1 = 16 - off;
|
- UUID: bytes 0x10 to 0x1f
|
||||||
in_row1 = min(in_row1, count);
|
- Serial number: 0xc0 to 0xdf */
|
||||||
memset(buf, 0, in_row1);
|
if (data->nature == VAIO && !capable(CAP_SYS_ADMIN)) {
|
||||||
if (count - in_row1 > 0)
|
int i;
|
||||||
memcpy(buf + in_row1, &data->data[16], count - in_row1);
|
|
||||||
|
for (i = 0; i < count; i++) {
|
||||||
|
if ((off + i <= 0x1f) ||
|
||||||
|
(off + i >= 0xc0 && off + i <= 0xdf))
|
||||||
|
buf[i] = 0;
|
||||||
|
else
|
||||||
|
buf[i] = data->data[off + i];
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
memcpy(buf, &data->data[off], count);
|
memcpy(buf, &data->data[off], count);
|
||||||
}
|
}
|
||||||
|
@ -204,7 +211,7 @@ static int eeprom_detect(struct i2c_adapter *adapter, int address, int kind)
|
||||||
&& i2c_smbus_read_byte(new_client) == 'G'
|
&& i2c_smbus_read_byte(new_client) == 'G'
|
||||||
&& i2c_smbus_read_byte(new_client) == '-') {
|
&& i2c_smbus_read_byte(new_client) == '-') {
|
||||||
dev_info(&new_client->dev, "Vaio EEPROM detected, "
|
dev_info(&new_client->dev, "Vaio EEPROM detected, "
|
||||||
"enabling password protection\n");
|
"enabling privacy protection\n");
|
||||||
data->nature = VAIO;
|
data->nature = VAIO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue