aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/i2c/chips/eeprom.c23
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 }