aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw
diff options
context:
space:
mode:
authorBryan O'Sullivan <bos@pathscale.com>2006-09-28 12:00:05 -0400
committerRoland Dreier <rolandd@cisco.com>2006-09-28 14:16:37 -0400
commit7dae5bff2e8e4699744e782a6e7605ad18d1240e (patch)
treedc771fe6e05c45eeabc66812f7706345042dbb87 /drivers/infiniband/hw
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')
-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 c8a8af0fe471..a507d0b5be6c 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,
356 356
357 pos = *ppos; 357 pos = *ppos;
358 358
359 if ( pos < 0) { 359 if (pos != 0) {
360 ret = -EINVAL; 360 ret = -EINVAL;
361 goto bail; 361 goto bail;
362 } 362 }
363 363
364 if (pos >= sizeof(struct ipath_flash)) { 364 if (count != sizeof(struct ipath_flash)) {
365 ret = 0; 365 ret = -EINVAL;
366 goto bail; 366 goto bail;
367 } 367 }
368 368
369 if (count > sizeof(struct ipath_flash) - pos)
370 count = sizeof(struct ipath_flash) - pos;
371
372 tmp = kmalloc(count, GFP_KERNEL); 369 tmp = kmalloc(count, GFP_KERNEL);
373 if (!tmp) { 370 if (!tmp) {
374 ret = -ENOMEM; 371 ret = -ENOMEM;