Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

nvmem: core: Check read_only flag for force_ro in bin_attr_nvmem_write()

The bin_attr_nvmem_write() must check the read_only flag and block
writes on read-only devices, now that a nvmem device can be switched
between read-write and read-only mode at runtime using the force_ro
attribute. Add the missing check.

Fixes: 9d7eb234ac7a ("nvmem: core: Implement force_ro sysfs attribute")
Cc: Stable@vger.kernel.org
Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20241030140253.40445-2-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Marek Vasut and committed by
Greg Kroah-Hartman
da959695 ce8f9fb6

+1 -1
+1 -1
drivers/nvmem/core.c
··· 267 267 268 268 count = round_down(count, nvmem->word_size); 269 269 270 - if (!nvmem->reg_write) 270 + if (!nvmem->reg_write || nvmem->read_only) 271 271 return -EPERM; 272 272 273 273 rc = nvmem_reg_write(nvmem, pos, buf, count);