[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>
Esse commit está contido em:
Bryan O'Sullivan
2006-07-01 04:35:55 -07:00
commit de Linus Torvalds
commit 4a45b7d4ec
3 arquivos alterados com 24 adições e 0 exclusões

Ver arquivo

@@ -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);