[ofw] [PATCH] IBAL - check port_num in av verbs
Reuven Amitai
reuven at mellanox.co.il
Wed Aug 27 09:48:53 PDT 2008
Hi Leonid,
The patch adds checking of the port_num field in av verbs when
"get_gid_index" is called.
In previous revision "get_gid_index" was in uvp code and port_num was
checked in order to
return correct value (see ib_al.h #965) and also protect p_port_attr
array.
[MLNX : 3052]
Thanks, Reuven.
>>>>>>>>>>>>>>>>>>>>>>>>>>
Index: core/al/user/ual_av.c
===================================================================
--- core/al/user/ual_av.c (revision 1521)
+++ core/al/user/ual_av.c (working copy)
@@ -58,6 +58,16 @@
uint16_t i;
ci_ca_lock_attr( p_ci_ca );
+
+ // sanity check
+ if (port_num == 0 || port_num > p_ci_ca->p_user_attr->num_ports)
+ {
+ AL_PRINT(TRACE_LEVEL_WARNING ,AL_DBG_AV,
+ ("UAL_GET_GID_INDEX: invalid port number specified (%d)\n",
port_num) );
+ status = IB_INVALID_PORT;
+ goto out;
+ }
+
p_port_attr = &p_ci_ca->p_user_attr->p_port_attr[port_num];
for( i = 0; i < p_port_attr->num_gids; i++ )
{
@@ -68,6 +78,8 @@
break;
}
}
+
+out:
ci_ca_unlock_attr( p_ci_ca );
return status;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20080827/66c68486/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: invalid_port_num.patch
Type: application/octet-stream
Size: 747 bytes
Desc: invalid_port_num.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20080827/66c68486/attachment.obj>
More information about the ofw
mailing list