mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] nvmem: core: Check read_only flag for force_ro in bin_attr_nvmem_write()
@ 2024-07-13 15:39 Marek Vasut
  2024-09-24 22:42 ` Marek Vasut
  0 siblings, 1 reply; 5+ messages in thread
From: Marek Vasut @ 2024-07-13 15:39 UTC (permalink / raw)
  To: linux-i2c; +Cc: Marek Vasut, Srinivas Kandagatla, linux-kernel

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")
Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: linux-kernel@vger.kernel.org
---
 drivers/nvmem/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 516dfd861b9f9..9cfe7d4bcda39 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -267,7 +267,7 @@ static ssize_t bin_attr_nvmem_write(struct file *filp, struct kobject *kobj,
 
 	count = round_down(count, nvmem->word_size);
 
-	if (!nvmem->reg_write)
+	if (!nvmem->reg_write || nvmem->read_only)
 		return -EPERM;
 
 	rc = nvmem_reg_write(nvmem, pos, buf, count);
-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] nvmem: core: Check read_only flag for force_ro in bin_attr_nvmem_write()
  2024-07-13 15:39 [PATCH] nvmem: core: Check read_only flag for force_ro in bin_attr_nvmem_write() Marek Vasut
@ 2024-09-24 22:42 ` Marek Vasut
  2024-10-25 23:15   ` Marek Vasut
  0 siblings, 1 reply; 5+ messages in thread
From: Marek Vasut @ 2024-09-24 22:42 UTC (permalink / raw)
  To: linux-i2c; +Cc: Srinivas Kandagatla, linux-kernel

On 7/13/24 5:39 PM, Marek Vasut wrote:
> 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")
> Signed-off-by: Marek Vasut <marex@denx.de>
> ---
> Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> Cc: linux-kernel@vger.kernel.org
It seems this bugfix is not even in next, any news ?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] nvmem: core: Check read_only flag for force_ro in bin_attr_nvmem_write()
  2024-09-24 22:42 ` Marek Vasut
@ 2024-10-25 23:15   ` Marek Vasut
  2024-10-26  7:21     ` Srinivas Kandagatla
  0 siblings, 1 reply; 5+ messages in thread
From: Marek Vasut @ 2024-10-25 23:15 UTC (permalink / raw)
  To: linux-i2c; +Cc: Srinivas Kandagatla, linux-kernel, Thorsten Leemhuis

On 9/25/24 12:42 AM, Marek Vasut wrote:
> On 7/13/24 5:39 PM, Marek Vasut wrote:
>> 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")
>> Signed-off-by: Marek Vasut <marex@denx.de>
>> ---
>> Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>> Cc: linux-kernel@vger.kernel.org
> It seems this bugfix is not even in next, any news ?

This is still broken, bugfix is available for three months now, but not 
picked up. Any news?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] nvmem: core: Check read_only flag for force_ro in bin_attr_nvmem_write()
  2024-10-25 23:15   ` Marek Vasut
@ 2024-10-26  7:21     ` Srinivas Kandagatla
  2024-10-26  7:36       ` Marek Vasut
  0 siblings, 1 reply; 5+ messages in thread
From: Srinivas Kandagatla @ 2024-10-26  7:21 UTC (permalink / raw)
  To: Marek Vasut, linux-i2c; +Cc: linux-kernel, Thorsten Leemhuis

Apologies, some how I missed this email.

On 26/10/2024 00:15, Marek Vasut wrote:
> On 9/25/24 12:42 AM, Marek Vasut wrote:
>> On 7/13/24 5:39 PM, Marek Vasut wrote:
>>> 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")
>>> Signed-off-by: Marek Vasut <marex@denx.de>

Applied with CC stable.

--srini
>>> ---
>>> Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>>> Cc: linux-kernel@vger.kernel.org
>> It seems this bugfix is not even in next, any news ?
> 
> This is still broken, bugfix is available for three months now, but not 
> picked up. Any news?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] nvmem: core: Check read_only flag for force_ro in bin_attr_nvmem_write()
  2024-10-26  7:21     ` Srinivas Kandagatla
@ 2024-10-26  7:36       ` Marek Vasut
  0 siblings, 0 replies; 5+ messages in thread
From: Marek Vasut @ 2024-10-26  7:36 UTC (permalink / raw)
  To: Srinivas Kandagatla, linux-i2c; +Cc: linux-kernel, Thorsten Leemhuis

On 10/26/24 9:21 AM, Srinivas Kandagatla wrote:
> Apologies, some how I missed this email.

No worries, the commit was still in my upstreaming queue, so I figured 
it was time to remind upstream about it.

> On 26/10/2024 00:15, Marek Vasut wrote:
>> On 9/25/24 12:42 AM, Marek Vasut wrote:
>>> On 7/13/24 5:39 PM, Marek Vasut wrote:
>>>> 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")
>>>> Signed-off-by: Marek Vasut <marex@denx.de>
> 
> Applied with CC stable.

Thank you !

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-10-26  7:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-13 15:39 [PATCH] nvmem: core: Check read_only flag for force_ro in bin_attr_nvmem_write() Marek Vasut
2024-09-24 22:42 ` Marek Vasut
2024-10-25 23:15   ` Marek Vasut
2024-10-26  7:21     ` Srinivas Kandagatla
2024-10-26  7:36       ` Marek Vasut

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®