eeprom: at24: make spd world-readable again [Linux 4.14.137]

This Linux kernel change "eeprom: at24: make spd world-readable again" is included in the Linux 4.14.137 release. This change is authored by Jean Delvare <jdelvare [at]> on Sun Jul 28 18:41:38 2019 +0200. The commit for this change in Linux stable tree is 321d657 (patch) which is from upstream commit 25e5ef3. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream 25e5ef3.

eeprom: at24: make spd world-readable again

commit 25e5ef302c24a6fead369c0cfe88c073d7b97ca8 upstream.

The integration of the at24 driver into the nvmem framework broke the
world-readability of spd EEPROMs. Fix it.

Signed-off-by: Jean Delvare <>
Fixes: 57d155506dd5 ("eeprom: at24: extend driver to plug into the NVMEM framework")
Cc: Andrew Lunn <>
Cc: Srinivas Kandagatla <>
Cc: Greg Kroah-Hartman <>
Cc: Bartosz Golaszewski <>
Cc: Arnd Bergmann <>
Signed-off-by: Bartosz Golaszewski <>
[Bartosz: backported the patch to older branches]
Signed-off-by: Bartosz Golaszewski <>
Signed-off-by: Greg Kroah-Hartman <>

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/misc/eeprom/at24.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index 6b58ee2..f8cfcd0 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -834,7 +834,7 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
    at24-> = dev_name(&client->dev);
    at24-> = &client->dev;
    at24->nvmem_config.read_only = !writable;
-   at24->nvmem_config.root_only = true;
+   at24->nvmem_config.root_only = !(chip.flags & AT24_FLAG_IRUGO);
    at24->nvmem_config.owner = THIS_MODULE;
    at24->nvmem_config.compat = true;
    at24->nvmem_config.base_dev = &client->dev;

Leave a Reply

Your email address will not be published. Required fields are marked *