mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
IB/ipath: Only allow complete writes to flash
Don't allow a write to the eeprom from ipathfs unless the write is exactly 128 bytes and starts at offset 0. Signed-off-by: Bryan O'Sullivan <[email protected]> Signed-off-by: Roland Dreier <[email protected]>
This commit is contained in:
parent
f3e93c7757
commit
7dae5bff2e
1 changed files with 3 additions and 6 deletions
|
|
@ -356,19 +356,16 @@ static ssize_t flash_write(struct file *file, const char __user *buf,
|
|||
|
||||
pos = *ppos;
|
||||
|
||||
if ( pos < 0) {
|
||||
if (pos != 0) {
|
||||
ret = -EINVAL;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
if (pos >= sizeof(struct ipath_flash)) {
|
||||
ret = 0;
|
||||
if (count != sizeof(struct ipath_flash)) {
|
||||
ret = -EINVAL;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
if (count > sizeof(struct ipath_flash) - pos)
|
||||
count = sizeof(struct ipath_flash) - pos;
|
||||
|
||||
tmp = kmalloc(count, GFP_KERNEL);
|
||||
if (!tmp) {
|
||||
ret = -ENOMEM;
|
||||
|
|
|
|||
Loading…
Reference in a new issue