summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorMichael Albaugh <Michael.Albaugh@Qlogic.com>2008-04-17 06:09:28 +0200
committerRoland Dreier <rolandd@cisco.com>2008-04-17 06:09:28 +0200
commitafd9970f957454782795b23c89fd6d7dde973cc0 (patch)
treedcaeb7d6c299afa22173e9866ccfacb607ce265c /drivers/infiniband
parentIB/core: Check optional verbs before using them (diff)
downloadlinux-afd9970f957454782795b23c89fd6d7dde973cc0.tar.xz
linux-afd9970f957454782795b23c89fd6d7dde973cc0.zip
IB/ipath: Allow old and new diagnostic packet formats
This patch checks for old and new format writes to send a packet via the diagnostic interface. Signed-off-by: Michael Albaugh <Michael.Albaugh@Qlogic.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_diag.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_diag.c b/drivers/infiniband/hw/ipath/ipath_diag.c
index af59bf380ca2..c9bfd827e71b 100644
--- a/drivers/infiniband/hw/ipath/ipath_diag.c
+++ b/drivers/infiniband/hw/ipath/ipath_diag.c
@@ -332,12 +332,17 @@ static ssize_t ipath_diagpkt_write(struct file *fp,
u64 val;
u32 l_state, lt_state; /* LinkState, LinkTrainingState */
- if (count != sizeof(dp)) {
+ if (count < sizeof(odp)) {
ret = -EINVAL;
goto bail;
}
- if (copy_from_user(&dp, data, sizeof(dp))) {
+ if (count == sizeof(dp)) {
+ if (copy_from_user(&dp, data, sizeof(dp))) {
+ ret = -EFAULT;
+ goto bail;
+ }
+ } else if (copy_from_user(&odp, data, sizeof(odp))) {
ret = -EFAULT;
goto bail;
}