* [PATCH v2 1/2] eeprom: at24: make spd world-readable again
@ 2019-07-28 16:41 Jean Delvare
2019-07-28 16:42 ` [PATCH v2 2/2] nvmem: Use the same permissions for eeprom as for nvmem Jean Delvare
2019-07-28 16:50 ` [PATCH v2 1/2] eeprom: at24: make spd world-readable again Bartosz Golaszewski
0 siblings, 2 replies; 4+ messages in thread
From: Jean Delvare @ 2019-07-28 16:41 UTC (permalink / raw)
To: Linux I2C
Cc: Andrew Lunn, Srinivas Kandagatla, Greg Kroah-Hartman,
Bartosz Golaszewski, Arnd Bergmann, LKML
The integration of the at24 driver into the nvmem framework broke the
world-readability of spd EEPROMs. Fix it.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Fixes: 57d155506dd5 ("eeprom: at24: extend driver to plug into the NVMEM framework")
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Arnd Bergmann <arnd@arndb.de>
---
Note: This is only the 1st half of the fix, the nvmem core driver
also needs to be fixed.
Changes since V1:
* Split into 2 patches, one to the at24 driver and one to the nvmem
core.
drivers/misc/eeprom/at24.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- linux-5.1.orig/drivers/misc/eeprom/at24.c 2019-07-28 16:52:06.550918923 +0200
+++ linux-5.1/drivers/misc/eeprom/at24.c 2019-07-28 16:53:28.104167083 +0200
@@ -719,7 +719,7 @@ static int at24_probe(struct i2c_client
nvmem_config.name = dev_name(dev);
nvmem_config.dev = dev;
nvmem_config.read_only = !writable;
- nvmem_config.root_only = true;
+ nvmem_config.root_only = !(flags & AT24_FLAG_IRUGO);
nvmem_config.owner = THIS_MODULE;
nvmem_config.compat = true;
nvmem_config.base_dev = dev;
--
Jean Delvare
SUSE L3 Support
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 2/2] nvmem: Use the same permissions for eeprom as for nvmem
2019-07-28 16:41 [PATCH v2 1/2] eeprom: at24: make spd world-readable again Jean Delvare
@ 2019-07-28 16:42 ` Jean Delvare
2019-07-28 16:50 ` Bartosz Golaszewski
2019-07-28 16:50 ` [PATCH v2 1/2] eeprom: at24: make spd world-readable again Bartosz Golaszewski
1 sibling, 1 reply; 4+ messages in thread
From: Jean Delvare @ 2019-07-28 16:42 UTC (permalink / raw)
To: Linux I2C
Cc: Andrew Lunn, Srinivas Kandagatla, Greg Kroah-Hartman,
Bartosz Golaszewski, Arnd Bergmann, LKML
The compatibility "eeprom" attribute is currently root-only no
matter what the configuration says. The "nvmem" attribute does
respect the setting of the root_only configuration bit, so do the
same for "eeprom".
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Fixes: b6c217ab9be6 ("nvmem: Add backwards compatibility support for older EEPROM drivers.")
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Arnd Bergmann <arnd@arndb.de>
---
Changes since V1:
* Split into 2 patches, one to the at24 driver and one to the nvmem
core. drivers/nvmem/nvmem-sysfs.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
--- linux-5.2.orig/drivers/nvmem/nvmem-sysfs.c 2019-07-08 00:41:56.000000000 +0200
+++ linux-5.2/drivers/nvmem/nvmem-sysfs.c 2019-07-28 18:06:53.105140893 +0200
@@ -224,10 +224,17 @@ int nvmem_sysfs_setup_compat(struct nvme
if (!config->base_dev)
return -EINVAL;
- if (nvmem->read_only)
- nvmem->eeprom = bin_attr_ro_root_nvmem;
- else
- nvmem->eeprom = bin_attr_rw_root_nvmem;
+ if (nvmem->read_only) {
+ if (config->root_only)
+ nvmem->eeprom = bin_attr_ro_root_nvmem;
+ else
+ nvmem->eeprom = bin_attr_ro_nvmem;
+ } else {
+ if (config->root_only)
+ nvmem->eeprom = bin_attr_rw_root_nvmem;
+ else
+ nvmem->eeprom = bin_attr_rw_nvmem;
+ }
nvmem->eeprom.attr.name = "eeprom";
nvmem->eeprom.size = nvmem->size;
#ifdef CONFIG_DEBUG_LOCK_ALLOC
--
Jean Delvare
SUSE L3 Support
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 2/2] nvmem: Use the same permissions for eeprom as for nvmem
2019-07-28 16:42 ` [PATCH v2 2/2] nvmem: Use the same permissions for eeprom as for nvmem Jean Delvare
@ 2019-07-28 16:50 ` Bartosz Golaszewski
0 siblings, 0 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2019-07-28 16:50 UTC (permalink / raw)
To: Jean Delvare
Cc: Linux I2C, Andrew Lunn, Srinivas Kandagatla, Greg Kroah-Hartman,
Arnd Bergmann, LKML
niedz., 28 lip 2019 o 18:43 Jean Delvare <jdelvare@suse.de> napisał(a):
>
> The compatibility "eeprom" attribute is currently root-only no
> matter what the configuration says. The "nvmem" attribute does
> respect the setting of the root_only configuration bit, so do the
> same for "eeprom".
>
> Signed-off-by: Jean Delvare <jdelvare@suse.de>
> Fixes: b6c217ab9be6 ("nvmem: Add backwards compatibility support for older EEPROM drivers.")
> Cc: Andrew Lunn <andrew@lunn.ch>
> Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Bartosz Golaszewski <brgl@bgdev.pl>
> Cc: Arnd Bergmann <arnd@arndb.de>
> ---
> Changes since V1:
> * Split into 2 patches, one to the at24 driver and one to the nvmem
> core. drivers/nvmem/nvmem-sysfs.c | 15 +++++++++++----
>
> 1 file changed, 11 insertions(+), 4 deletions(-)
>
> --- linux-5.2.orig/drivers/nvmem/nvmem-sysfs.c 2019-07-08 00:41:56.000000000 +0200
> +++ linux-5.2/drivers/nvmem/nvmem-sysfs.c 2019-07-28 18:06:53.105140893 +0200
> @@ -224,10 +224,17 @@ int nvmem_sysfs_setup_compat(struct nvme
> if (!config->base_dev)
> return -EINVAL;
>
> - if (nvmem->read_only)
> - nvmem->eeprom = bin_attr_ro_root_nvmem;
> - else
> - nvmem->eeprom = bin_attr_rw_root_nvmem;
> + if (nvmem->read_only) {
> + if (config->root_only)
> + nvmem->eeprom = bin_attr_ro_root_nvmem;
> + else
> + nvmem->eeprom = bin_attr_ro_nvmem;
> + } else {
> + if (config->root_only)
> + nvmem->eeprom = bin_attr_rw_root_nvmem;
> + else
> + nvmem->eeprom = bin_attr_rw_nvmem;
> + }
> nvmem->eeprom.attr.name = "eeprom";
> nvmem->eeprom.size = nvmem->size;
> #ifdef CONFIG_DEBUG_LOCK_ALLOC
>
>
> --
> Jean Delvare
> SUSE L3 Support
Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/2] eeprom: at24: make spd world-readable again
2019-07-28 16:41 [PATCH v2 1/2] eeprom: at24: make spd world-readable again Jean Delvare
2019-07-28 16:42 ` [PATCH v2 2/2] nvmem: Use the same permissions for eeprom as for nvmem Jean Delvare
@ 2019-07-28 16:50 ` Bartosz Golaszewski
1 sibling, 0 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2019-07-28 16:50 UTC (permalink / raw)
To: Jean Delvare
Cc: Linux I2C, Andrew Lunn, Srinivas Kandagatla, Greg Kroah-Hartman,
Arnd Bergmann, LKML
niedz., 28 lip 2019 o 18:41 Jean Delvare <jdelvare@suse.de> napisał(a):
>
> The integration of the at24 driver into the nvmem framework broke the
> world-readability of spd EEPROMs. Fix it.
>
> Signed-off-by: Jean Delvare <jdelvare@suse.de>
> Fixes: 57d155506dd5 ("eeprom: at24: extend driver to plug into the NVMEM framework")
> Cc: Andrew Lunn <andrew@lunn.ch>
> Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Bartosz Golaszewski <brgl@bgdev.pl>
> Cc: Arnd Bergmann <arnd@arndb.de>
> ---
> Note: This is only the 1st half of the fix, the nvmem core driver
> also needs to be fixed.
>
> Changes since V1:
> * Split into 2 patches, one to the at24 driver and one to the nvmem
> core.
>
> drivers/misc/eeprom/at24.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- linux-5.1.orig/drivers/misc/eeprom/at24.c 2019-07-28 16:52:06.550918923 +0200
> +++ linux-5.1/drivers/misc/eeprom/at24.c 2019-07-28 16:53:28.104167083 +0200
> @@ -719,7 +719,7 @@ static int at24_probe(struct i2c_client
> nvmem_config.name = dev_name(dev);
> nvmem_config.dev = dev;
> nvmem_config.read_only = !writable;
> - nvmem_config.root_only = true;
> + nvmem_config.root_only = !(flags & AT24_FLAG_IRUGO);
> nvmem_config.owner = THIS_MODULE;
> nvmem_config.compat = true;
> nvmem_config.base_dev = dev;
>
>
> --
> Jean Delvare
> SUSE L3 Support
Applied to fixes.
Bart
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-07-28 16:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-28 16:41 [PATCH v2 1/2] eeprom: at24: make spd world-readable again Jean Delvare
2019-07-28 16:42 ` [PATCH v2 2/2] nvmem: Use the same permissions for eeprom as for nvmem Jean Delvare
2019-07-28 16:50 ` Bartosz Golaszewski
2019-07-28 16:50 ` [PATCH v2 1/2] eeprom: at24: make spd world-readable again Bartosz Golaszewski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).