mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
misc/at24: avoid infinite loop on write()
This change fixes a problem of infinite zero byte write() without an error status, if there is an attempt to write a file bigger than EEPROM size over sysfs interface. Signed-off-by: Vladimir Zapolskiy <[email protected]> Cc: Wolfram Sang <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
95f774c526
commit
7c65e29250
1 changed files with 3 additions and 0 deletions
|
|
@ -428,6 +428,9 @@ static ssize_t at24_bin_write(struct file *filp, struct kobject *kobj,
|
|||
{
|
||||
struct at24_data *at24;
|
||||
|
||||
if (unlikely(off >= attr->size))
|
||||
return -EFBIG;
|
||||
|
||||
at24 = dev_get_drvdata(container_of(kobj, struct device, kobj));
|
||||
return at24_write(at24, buf, off, count);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue