summaryrefslogtreecommitdiff
path: root/drivers/infiniband/hw/ipath/ipath_verbs.c
diff options
context:
space:
mode:
authorBryan O'Sullivan <bos@pathscale.com>2006-07-01 11:35:55 (GMT)
committerLinus Torvalds <torvalds@g5.osdl.org>2006-07-01 16:55:59 (GMT)
commit4a45b7d4ece0e6dc425e9f66fa8b501b72d846db (patch)
tree6e858b3343ffb3670eb6f5a838479d52791e0a30 /drivers/infiniband/hw/ipath/ipath_verbs.c
parent6665ddee85bfc336d691ea5132a2c20a1d0e8053 (diff)
downloadlinux-fsl-qoriq-4a45b7d4ece0e6dc425e9f66fa8b501b72d846db.tar.xz
[PATCH] IB/ipath: don't allow resources to be created with illegal values
Signed-off-by: Robert Walsh <robert.walsh@qlogic.com> Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com> Cc: "Michael S. Tsirkin" <mst@mellanox.co.il> Cc: Roland Dreier <rolandd@cisco.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/infiniband/hw/ipath/ipath_verbs.c')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_verbs.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c
index 6af5402..18375e8 100644
--- a/drivers/infiniband/hw/ipath/ipath_verbs.c
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.c
@@ -792,6 +792,17 @@ static struct ib_ah *ipath_create_ah(struct ib_pd *pd,
goto bail;
}
+ if (ah_attr->dlid == 0) {
+ ret = ERR_PTR(-EINVAL);
+ goto bail;
+ }
+
+ if (ah_attr->port_num != 1 ||
+ ah_attr->port_num > pd->device->phys_port_cnt) {
+ ret = ERR_PTR(-EINVAL);
+ goto bail;
+ }
+
ah = kmalloc(sizeof *ah, GFP_ATOMIC);
if (!ah) {
ret = ERR_PTR(-ENOMEM);