* [BACKPORT] nvmem: Use the same permissions for eeprom as for nvmem
@ 2019-09-17 14:30 Jean Delvare
2019-09-17 18:10 ` Greg Kroah-Hartman
0 siblings, 1 reply; 2+ messages in thread
From: Jean Delvare @ 2019-09-17 14:30 UTC (permalink / raw)
To: stable; +Cc: Bartosz Golaszewski, Greg Kroah-Hartman, Sasha Levin
[ Upstream commit e70d8b287301eb6d7c7761c6171c56af62110ea3 ]
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.")
Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20190728184255.563332e6@endymion
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
This is the backport of commit e70d8b287301 "nvmem: Use the same
permissions for eeprom as for nvmem" for stable kernel branches 4.19,
4.14 and 4.9. Thanks.
drivers/nvmem/core.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
--- linux-4.19.orig/drivers/nvmem/core.c 2019-09-17 11:34:16.250719885 +0200
+++ linux-4.19/drivers/nvmem/core.c 2019-09-17 16:09:45.146604199 +0200
@@ -415,10 +415,17 @@ static int nvmem_setup_compat(struct nvm
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] 2+ messages in thread
* Re: [BACKPORT] nvmem: Use the same permissions for eeprom as for nvmem
2019-09-17 14:30 [BACKPORT] nvmem: Use the same permissions for eeprom as for nvmem Jean Delvare
@ 2019-09-17 18:10 ` Greg Kroah-Hartman
0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2019-09-17 18:10 UTC (permalink / raw)
To: Jean Delvare; +Cc: stable, Bartosz Golaszewski, Sasha Levin
On Tue, Sep 17, 2019 at 04:30:01PM +0200, Jean Delvare wrote:
> [ Upstream commit e70d8b287301eb6d7c7761c6171c56af62110ea3 ]
>
> 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.")
> Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> Cc: Andrew Lunn <andrew@lunn.ch>
> Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Link: https://lore.kernel.org/r/20190728184255.563332e6@endymion
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
> This is the backport of commit e70d8b287301 "nvmem: Use the same
> permissions for eeprom as for nvmem" for stable kernel branches 4.19,
> 4.14 and 4.9. Thanks.
Now queued up, thanks.
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-09-17 18:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-17 14:30 [BACKPORT] nvmem: Use the same permissions for eeprom as for nvmem Jean Delvare
2019-09-17 18:10 ` Greg Kroah-Hartman
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).