mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
nvmem: core: return EFBIG on out-of-range write
When writing data that exceeds the nvmem size to a nvmem sysfs file
using the sh redirection operator >, the shell hangs, trying to
write the out-of-range bytes endlessly.
Fix the problem by returning EFBIG described in man 2 write.
Similar change was done for binary sysfs files on commit
0936896056
Signed-off-by: Guy Shapiro <[email protected]>
Cc: [email protected]
Signed-off-by: Srinivas Kandagatla <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
93dc1774d2
commit
38b0774c05
1 changed files with 1 additions and 1 deletions
|
|
@ -135,7 +135,7 @@ static ssize_t bin_attr_nvmem_write(struct file *filp, struct kobject *kobj,
|
|||
|
||||
/* Stop the user from writing */
|
||||
if (pos >= nvmem->size)
|
||||
return 0;
|
||||
return -EFBIG;
|
||||
|
||||
if (count < nvmem->word_size)
|
||||
return -EINVAL;
|
||||
|
|
|
|||
Loading…
Reference in a new issue