aboutsummaryrefslogtreecommitdiff
path: root/drivers/infiniband/hw/ipath/ipath_fs.c
diff options
context:
space:
mode:
authorBryan O'Sullivan <bos@pathscale.com>2006-09-28 09:00:05 -0700
committerRoland Dreier <rolandd@cisco.com>2006-09-28 11:16:37 -0700
commit7dae5bff2e8e4699744e782a6e7605ad18d1240e (patch)
treedc771fe6e05c45eeabc66812f7706345042dbb87 /drivers/infiniband/hw/ipath/ipath_fs.c
parentf3e93c7757043cd5d5c4879b8b92effcc7817c81 (diff)
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 <bryan.osullivan@qlogic.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/ipath/ipath_fs.c')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_fs.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c
index c8a8af0fe47..a507d0b5be6 100644
--- a/drivers/infiniband/hw/ipath/ipath_fs.c
+++ b/drivers/infiniband/hw/ipath/ipath_fs.c
@@ -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;